How to use the ember-lifeline.addEventListener function in ember-lifeline

To help you get started, we’ve selected a few ember-lifeline examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nano-wallet-company / nano-wallet-desktop / app / electron / service.js View on Github external
constructor(...args) {
    super(...args);

    if (this.isElectron) {
      // eslint-disable-next-line no-undef
      const { shell, remote, ipcRenderer } = requireNode('electron');
      this.shell = shell;
      this.remote = remote;
      this.ipcRenderer = ipcRenderer;

      addEventListener(this, window, 'beforeunload', () =>
        this.ipcRenderer.send('window-unloading'),
      );

      const onDownloadProgress = ::this.onDownloadProgress;
      const onDownloadVerify = ::this.onDownloadVerify;
      const onDownloadExtract = ::this.onDownloadExtract;
      const onDownloadDone = ::this.onDownloadDone;
      const onNodeExit = ::this.onNodeExit;
      this.registerDisposable(() => {
        ipcRenderer.removeListener('download-progress', onDownloadProgress);
        ipcRenderer.removeListener('download-verify', onDownloadVerify);
        ipcRenderer.removeListener('download-extract', onDownloadExtract);
        ipcRenderer.removeListener('download-done', onDownloadDone);
        ipcRenderer.removeListener('node-exit', onNodeExit);
      });

ember-lifeline

Ember.js addon for lifecycle aware async tasks and DOM events.

MIT
Latest version published 1 year ago

Package Health Score

57 / 100
Full package analysis