diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-07-03 12:20:22 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-03 12:20:22 -0400 | 
| commit | a07a8dfff667e0bba20d7199c4d7aa610e98bcdb (patch) | |
| tree | 0621aa42db97b7ac39207452b54c10b528080f24 /ext/fg/js | |
| parent | ce634325ce3a6ba4994916116b15b90e92666255 (diff) | |
Extension unload detection (#647)
* Update how extension unload is detected
* Remove event handlers and use yomichan.isExtensionUnloaded instead
* Update terminology
Diffstat (limited to 'ext/fg/js')
| -rw-r--r-- | ext/fg/js/frontend.js | 10 | 
1 files changed, 2 insertions, 8 deletions
| diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index f6b0d236..33cb0b90 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -32,7 +32,6 @@ class Frontend {          this._options = null;          this._pageZoomFactor = 1.0;          this._contentScale = 1.0; -        this._orphaned = false;          this._lastShowPromise = Promise.resolve();          this._enabledEventListeners = new EventListenerCollection();          this._activeModifiers = new Set(); @@ -110,7 +109,6 @@ class Frontend {              visualViewport.addEventListener('resize', this._onVisualViewportResize.bind(this));          } -        yomichan.on('orphaned', this._onOrphaned.bind(this));          yomichan.on('optionsUpdated', this.updateOptions.bind(this));          yomichan.on('zoomChanged', this._onZoomChanged.bind(this));          chrome.runtime.onMessage.addListener(this._onRuntimeMessage.bind(this)); @@ -230,10 +228,6 @@ class Frontend {          return false;      } -    _onOrphaned() { -        this._orphaned = true; -    } -      _onZoomChanged({newZoomFactor}) {          this._pageZoomFactor = newZoomFactor;          this._updateContentScale(); @@ -370,9 +364,9 @@ class Frontend {                  }              }          } catch (e) { -            if (this._orphaned) { +            if (yomichan.isExtensionUnloaded) {                  if (textSource !== null && this._options.scanning.modifier !== 'none') { -                    this._showPopupContent(textSource, await this.getOptionsContext(), 'orphaned'); +                    this._showPopupContent(textSource, await this.getOptionsContext(), 'extensionUnloaded');                  }              } else {                  yomichan.logError(e); |