Skip to content

Class: DebugBridge ​

Defined in: src/utils/debugBridge.ts:31

Debug bridge. Runs a script from a zotero://ztoolkit-debug link.

It is not registered by default. Call DebugBridge.register() to enable it, only in development builds, and DebugBridge.unregister() on plugin shutdown.

Deprecated ​

Since this is a temporary solution for debugging, it is not recommended to use. The zotero-plugin-scaffold no longer need this.

Remarks ​

Global variables: Zotero, window(main window).

Examples ​

Enable it in development builds only.

ts
if (__env__ === "development") {
  DebugBridge.register({ disablePassword: true });
}
ts
Run script directly. The `run` is URIencoded script.

`zotero://ztoolkit-debug/?run=Zotero.getMainWindow().alert(%22HelloWorld!%22)&app=developer`
ts
Run script from file. The `file` is URIencoded path to js file starts with `file:///`

`zotero://ztoolkit-debug/?file=file%3A%2F%2F%2FC%3A%2FUsers%2Fw_xia%2FDesktop%2Frun.js&app=developer`

Constructors ​

Constructor ​

ts
new DebugBridge(): DebugBridge;

Returns ​

DebugBridge

Properties ​

passwordPref ​

ts
readonly static passwordPref: string = "extensions.zotero.debug-bridge.password";

Defined in: src/utils/debugBridge.ts:32

Accessors ​

password ​

Get Signature ​

ts
get static password(): string;

Defined in: src/utils/debugBridge.ts:38

Returns ​

string

Set Signature ​

ts
set static password(v): void;

Defined in: src/utils/debugBridge.ts:44

Parameters ​
v ​

string

Returns ​

void

Methods ​

register() ​

ts
static register(options): void;

Defined in: src/utils/debugBridge.ts:53

Register the zotero://ztoolkit-debug handler, replacing any registered before.

Parameters ​

options ​

Register options.

disablePassword? ​

boolean

Run commands without checking the password or asking the user.

Returns ​

void


unregister() ​

ts
static unregister(): void;

Defined in: src/utils/debugBridge.ts:135

Unregister the handler, if it is still the one registered by register.

Returns ​

void