update: make toolkit accessible
This commit is contained in:
parent
f87cdfa1ef
commit
d42abcbfcc
@ -1,3 +1,4 @@
|
||||
import ZoteroToolkit from "zotero-plugin-toolkit";
|
||||
import hooks from "./hooks";
|
||||
|
||||
class Addon {
|
||||
@ -5,6 +6,7 @@ class Addon {
|
||||
alive: boolean;
|
||||
// Env type, see build.js
|
||||
env: "development" | "production";
|
||||
ztoolkit: ZoteroToolkit;
|
||||
locale?: {
|
||||
stringBundle: any;
|
||||
};
|
||||
@ -19,6 +21,7 @@ class Addon {
|
||||
this.data = {
|
||||
alive: true,
|
||||
env: __env__,
|
||||
ztoolkit: new ZoteroToolkit(),
|
||||
};
|
||||
this.hooks = hooks;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ZoteroToolkit, { ZoteroCompat } from "zotero-plugin-toolkit";
|
||||
import { ZoteroCompat } from "zotero-plugin-toolkit";
|
||||
import Addon from "./addon";
|
||||
import { config } from "../package.json";
|
||||
|
||||
@ -11,8 +11,8 @@ if (!compat.getGlobal("Zotero").AddonTemplate) {
|
||||
_globalThis.Zotero_Tabs = compat.getGlobal("Zotero_Tabs");
|
||||
_globalThis.window = compat.getGlobal("window");
|
||||
_globalThis.document = compat.getGlobal("document");
|
||||
_globalThis.ztoolkit = new ZoteroToolkit();
|
||||
_globalThis.addon = new Addon();
|
||||
_globalThis.ztoolkit = addon.data.ztoolkit;
|
||||
ztoolkit.Tool.logOptionsGlobal.prefix = `[${config.addonName}]`;
|
||||
ztoolkit.Tool.logOptionsGlobal.disableConsole =
|
||||
addon.data.env === "production";
|
||||
|
Loading…
x
Reference in New Issue
Block a user