Skip to content

Commit d3c3cde

Browse files
committed
feat: export scrapox and cosense
Users no longer write `declare const scrapbox: Scrapbox;` in each file.
1 parent 666761c commit d3c3cde

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

userscript.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,19 @@ export * from "./pageMenu.ts";
1010
export * from "./eventName.ts";
1111
export * from "./scrapbox.ts";
1212
export type { EventEmitter } from "./vendor/events.ts";
13+
import type { Scrapbox } from "./scrapbox.ts";
14+
15+
// The following assignments are a workaround for esbuild
16+
// Use IIFE to tree-shaking
17+
18+
/** `scrapbox` */
19+
export const scrapbox: Scrapbox = /* @__PURE__ */ (
20+
// deno-lint-ignore no-explicit-any
21+
() => (globalThis as any).scrapbox
22+
)();
23+
24+
/** an alias for {@linkcode scrapbox} */
25+
export const cosense: Scrapbox = /* @__PURE__ */ (
26+
// deno-lint-ignore no-explicit-any
27+
() => (globalThis as any).cosense
28+
)();

0 commit comments

Comments
 (0)