This API is awesome.
I tested the following codes. The onMainWindowLoad() succeeded help to restart the plugin when reopened the Mac Zotero Window. It is great!
// Mac 上关闭 Zotero 主窗口后,重新打开窗口后,启动插件
function onMainWindowLoad({ id, version, resourceURI, rootURI = resourceURI.spec }) {
startup({ id, version, resourceURI, rootURI});
}
Besides, I want to know whether it is necessary to call shutdown() in the onMainWindowUnload() to avoid memory leakage as the following codes shows? Or Maybe the shutdown() will be called automatically when the Mac Zotero MainWindow is closed, even if not calling shutdown in onMainWindowUnload()?
// Mac 上关闭 Zotero 主窗口后,执行 shutdown 程序,防止内存泄漏
function onMainWindowUnload({ id, version, resourceURI, rootURI = resourceURI.spec }) {
shutdown({ id, version, resourceURI, rootURI});
}