-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy pathaddon.ts
40 lines (37 loc) · 853 Bytes
/
addon.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { config } from "../package.json";
import { ColumnOptions, DialogHelper } from "zotero-plugin-toolkit";
import hooks from "./hooks";
import { createZToolkit } from "./utils/ztoolkit";
class Addon {
public data: {
alive: boolean;
config: typeof config;
// Env type, see build.js
env: "development" | "production";
ztoolkit: ZToolkit;
locale?: {
current: any;
};
prefs?: {
window: Window;
columns: Array<ColumnOptions>;
rows: Array<{ [dataKey: string]: string }>;
};
dialog?: DialogHelper;
};
// Lifecycle hooks
public hooks: typeof hooks;
// APIs
public api: object;
constructor() {
this.data = {
alive: true,
config,
env: __env__,
ztoolkit: createZToolkit(),
};
this.hooks = hooks;
this.api = {};
}
}
export default Addon;