skip layout-ready setup if already unloaded
This commit is contained in:
@@ -9,6 +9,8 @@ module.exports = class RibbonClasp extends Plugin {
|
|||||||
this.debouncedEnforce = debounce(() => this.enforceOrder(), 200, true);
|
this.debouncedEnforce = debounce(() => this.enforceOrder(), 200, true);
|
||||||
|
|
||||||
this.app.workspace.onLayoutReady(() => {
|
this.app.workspace.onLayoutReady(() => {
|
||||||
|
// not tied to our lifecycle; still fires if we were disabled during boot
|
||||||
|
if (this.unloaded) return;
|
||||||
this.patchRibbon();
|
this.patchRibbon();
|
||||||
this.enforceOrder();
|
this.enforceOrder();
|
||||||
this.observeRibbon();
|
this.observeRibbon();
|
||||||
@@ -16,6 +18,7 @@ module.exports = class RibbonClasp extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onunload() {
|
onunload() {
|
||||||
|
this.unloaded = true;
|
||||||
this.observer?.disconnect();
|
this.observer?.disconnect();
|
||||||
// disconnect doesn't stop an already-scheduled call
|
// disconnect doesn't stop an already-scheduled call
|
||||||
this.debouncedEnforce?.cancel();
|
this.debouncedEnforce?.cancel();
|
||||||
|
|||||||
Reference in New Issue
Block a user