Close all tabs and unregister tabs observer when destroying main window
#2005
This commit is contained in:
parent
bf84e16002
commit
1ede4240e0
3 changed files with 11 additions and 1 deletions
|
@ -50,7 +50,7 @@ const ZoteroStandalone = new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.switchMenuType('library');
|
this.switchMenuType('library');
|
||||||
Zotero.Notifier.registerObserver(
|
this._notifierID = Zotero.Notifier.registerObserver(
|
||||||
{
|
{
|
||||||
notify: async (action, type, ids, extraData) => {
|
notify: async (action, type, ids, extraData) => {
|
||||||
if (action == 'select') {
|
if (action == 'select') {
|
||||||
|
@ -586,6 +586,7 @@ const ZoteroStandalone = new function() {
|
||||||
* Called before standalone window is closed
|
* Called before standalone window is closed
|
||||||
*/
|
*/
|
||||||
this.onUnload = function() {
|
this.onUnload = function() {
|
||||||
|
Zotero.Notifier.unregisterObserver(this._notifierID);
|
||||||
ZoteroPane.destroy();
|
ZoteroPane.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,6 +169,13 @@ var Zotero_Tabs = new function () {
|
||||||
}*/
|
}*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close all tabs except the first one
|
||||||
|
*/
|
||||||
|
this.closeAll = function () {
|
||||||
|
this._tabs.slice(1).map(tab => this.close(tab.id));
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move a tab to the specified index
|
* Move a tab to the specified index
|
||||||
*
|
*
|
||||||
|
|
|
@ -370,6 +370,8 @@ var ZoteroPane = new function()
|
||||||
if(this.itemsView) this.itemsView.unregister();
|
if(this.itemsView) this.itemsView.unregister();
|
||||||
|
|
||||||
observerService.removeObserver(_reloadObserver, "zotero-reloaded");
|
observerService.removeObserver(_reloadObserver, "zotero-reloaded");
|
||||||
|
|
||||||
|
Zotero_Tabs.closeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue