42 lines
943 B
TypeScript
42 lines
943 B
TypeScript
import { config } from "../package.json";
|
|
import { ColumnOptions } from "zotero-plugin-toolkit/dist/helpers/virtualizedTable";
|
|
import { DialogHelper } from "zotero-plugin-toolkit/dist/helpers/dialog";
|
|
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;
|