@vacantthinker/firefox-addon-framework-easy 2026.617.739 → 2026.617.1939

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,4 +42,13 @@ export interface MessagePayloadFocusTargetTab {
42
42
  export declare function ctJsFocusTargetTabUseRuntimeMessage(targetTabId: number): Promise<void>;
43
43
  export declare function ctJsFocusTargetTab(targetTabId: number): Promise<void>;
44
44
  export declare function ctJsRemoveDomainCache(domain: string): Promise<void>;
45
- //# sourceMappingURL=serviceOpContentJsYTB.d.ts.map
45
+ /**
46
+ * Executes a provided function once the DOM is ready.
47
+ * If the DOM is already ready, it executes immediately.
48
+ * * @param fn - The function to execute. Can be a synchronous or asynchronous
49
+ * function.
50
+ */
51
+ export declare function ctJsExecuteOnReady(fn: () => void | Promise<void>): Promise<void>;
52
+ export declare function ctJsOpenPage(url: string): Promise<void>;
53
+ export declare function ctJsOpenPageKeepOnlyOne(url: string): Promise<void>;
54
+ //# sourceMappingURL=ContentJsYTB.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentJsYTB.d.ts","sourceRoot":"","sources":["../src/ContentJsYTB.ts"],"names":[],"mappings":"AAOA;;;;;;;;GAQG;AACH,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,GAAE,MAAc,GAAG,IAAI,CAmCvG;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOvE;AAED,wBAAsB,wBAAwB,kBAE7C;AAED,wBAAsB,wBAAwB,kBAE7C;AAED,wBAAsB,wBAAwB,kBAE7C;AAED,wBAAsB,uBAAuB,kBAE5C;AAED,wBAAsB,sBAAsB,kBAE3C;AAGD;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKpE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAW,EAAE,SAAS,UAAQ,QAShE;AAED,wBAAsB,YAAY,kBAIjC;AAED,MAAM,WAAW,4BAA4B;IAC3C,GAAG,EAAE,mBAAmB,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,mCAAmC,CAAC,WAAW,EAAE,MAAM,iBAM5E;AAED,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,iBAE3D;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,iBAEzD;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBtF;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,iBAE7C;AAED,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,MAAM,iBAExD"}
@@ -1,4 +1,4 @@
1
- import { tabOpFocus } from "./opTab";
1
+ import { tabOpCreateActiveTrue, tabOpCreateKeepOnlyOneFocusTrue, tabOpFocus } from "./opTab";
2
2
  import { browserBrowsingDataRemoveDomainCache } from "./browserBrowsingData";
3
3
  /**
4
4
  * Captures an <img> element from the current document, draws it to a canvas
@@ -106,3 +106,30 @@ export async function ctJsFocusTargetTab(targetTabId) {
106
106
  export async function ctJsRemoveDomainCache(domain) {
107
107
  await browserBrowsingDataRemoveDomainCache(domain);
108
108
  }
109
+ /**
110
+ * Executes a provided function once the DOM is ready.
111
+ * If the DOM is already ready, it executes immediately.
112
+ * * @param fn - The function to execute. Can be a synchronous or asynchronous
113
+ * function.
114
+ */
115
+ export async function ctJsExecuteOnReady(fn) {
116
+ if (document.readyState === 'loading') {
117
+ // DOM is still loading, wait for the event
118
+ await new Promise((resolve) => {
119
+ document.addEventListener('DOMContentLoaded', async () => {
120
+ await fn();
121
+ resolve();
122
+ }, { once: true });
123
+ });
124
+ }
125
+ else {
126
+ // DOM is already ready, execute immediately
127
+ await fn();
128
+ }
129
+ }
130
+ export async function ctJsOpenPage(url) {
131
+ await tabOpCreateActiveTrue({ url });
132
+ }
133
+ export async function ctJsOpenPageKeepOnlyOne(url) {
134
+ await tabOpCreateKeepOnlyOneFocusTrue(url);
135
+ }
package/dist/index.d.ts CHANGED
@@ -6,12 +6,12 @@ export * from './browserDownload';
6
6
  export * from './browserNotification';
7
7
  export * from './browserRuntime';
8
8
  export * from './browserTab';
9
+ export * from './ContentJsYTB';
9
10
  export * from './opStorage';
10
11
  export * from './opTab';
11
12
  export * from './serviceCommon';
12
13
  export * from './serviceFetch';
13
14
  export * from './serviceGet';
14
- export * from './serviceOpContentJsYTB';
15
15
  export * from './serviceOpContent';
16
16
  export * from './serviceOperationYTB';
17
17
  export * from './serviceOpJavascript';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -6,12 +6,12 @@ export * from './browserDownload';
6
6
  export * from './browserNotification';
7
7
  export * from './browserRuntime';
8
8
  export * from './browserTab';
9
+ export * from './ContentJsYTB';
9
10
  export * from './opStorage';
10
11
  export * from './opTab';
11
12
  export * from './serviceCommon';
12
13
  export * from './serviceFetch';
13
14
  export * from './serviceGet';
14
- export * from './serviceOpContentJsYTB';
15
15
  export * from './serviceOpContent';
16
16
  export * from './serviceOperationYTB';
17
17
  export * from './serviceOpJavascript';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.0617.0739",
3
+ "version": "2026.0617.1939",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"file":"serviceOpContentJsYTB.d.ts","sourceRoot":"","sources":["../src/serviceOpContentJsYTB.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,GAAE,MAAc,GAAG,IAAI,CAmCvG;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOvE;AAED,wBAAsB,wBAAwB,kBAE7C;AAED,wBAAsB,wBAAwB,kBAE7C;AAED,wBAAsB,wBAAwB,kBAE7C;AAED,wBAAsB,uBAAuB,kBAE5C;AAED,wBAAsB,sBAAsB,kBAE3C;AAGD;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKpE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAW,EAAE,SAAS,UAAQ,QAShE;AAED,wBAAsB,YAAY,kBAIjC;AAED,MAAM,WAAW,4BAA4B;IAC3C,GAAG,EAAE,mBAAmB,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,mCAAmC,CAAC,WAAW,EAAE,MAAM,iBAM5E;AAED,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,iBAE3D;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,iBAEzD"}