wxt 0.6.2 → 0.6.3

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.
package/dist/index.d.cts CHANGED
@@ -32,6 +32,18 @@ declare class ContentScriptContext extends AbortController {
32
32
  * removeInvalidatedListener();
33
33
  */
34
34
  onInvalidated(cb: () => void): () => void;
35
+ /**
36
+ * Return a promise that never resolves. Useful if you have an async function that shouldn't run
37
+ * after the context is expired.
38
+ *
39
+ * @example
40
+ * const getValueFromStorage = async () => {
41
+ * if (ctx.isInvalid) return ctx.block();
42
+ *
43
+ * // ...
44
+ * }
45
+ */
46
+ block<T>(): Promise<T>;
35
47
  /**
36
48
  * Wrapper around `window.setInterval` that automatically clears the interval when invalidated.
37
49
  */
@@ -50,6 +62,18 @@ declare class ContentScriptContext extends AbortController {
50
62
  * invalidated.
51
63
  */
52
64
  requestIdleCallback(callback: IdleRequestCallback, options?: IdleRequestOptions): number;
65
+ /**
66
+ * Call `target.addEventListener` and remove the event listener when the context is invalidated.
67
+ *
68
+ * @example
69
+ * ctx.addEventListener(window, "mousemove", () => {
70
+ * // ...
71
+ * });
72
+ * ctx.addEventListener(document, "visibilitychange", () => {
73
+ * // ...
74
+ * });
75
+ */
76
+ addEventListener(target: any, type: string, handler: (event: Event) => void, options?: AddEventListenerOptions): void;
53
77
  /**
54
78
  * Abort the abort controller and execute all `onInvalidated` listeners.
55
79
  */
@@ -514,7 +538,7 @@ type EntrypointGroup = Entrypoint | Entrypoint[];
514
538
  */
515
539
  declare function clean(root?: string): Promise<void>;
516
540
 
517
- var version = "0.6.2";
541
+ var version = "0.6.3";
518
542
 
519
543
  declare function defineConfig(config: UserConfig): UserConfig;
520
544
 
package/dist/index.d.ts CHANGED
@@ -32,6 +32,18 @@ declare class ContentScriptContext extends AbortController {
32
32
  * removeInvalidatedListener();
33
33
  */
34
34
  onInvalidated(cb: () => void): () => void;
35
+ /**
36
+ * Return a promise that never resolves. Useful if you have an async function that shouldn't run
37
+ * after the context is expired.
38
+ *
39
+ * @example
40
+ * const getValueFromStorage = async () => {
41
+ * if (ctx.isInvalid) return ctx.block();
42
+ *
43
+ * // ...
44
+ * }
45
+ */
46
+ block<T>(): Promise<T>;
35
47
  /**
36
48
  * Wrapper around `window.setInterval` that automatically clears the interval when invalidated.
37
49
  */
@@ -50,6 +62,18 @@ declare class ContentScriptContext extends AbortController {
50
62
  * invalidated.
51
63
  */
52
64
  requestIdleCallback(callback: IdleRequestCallback, options?: IdleRequestOptions): number;
65
+ /**
66
+ * Call `target.addEventListener` and remove the event listener when the context is invalidated.
67
+ *
68
+ * @example
69
+ * ctx.addEventListener(window, "mousemove", () => {
70
+ * // ...
71
+ * });
72
+ * ctx.addEventListener(document, "visibilitychange", () => {
73
+ * // ...
74
+ * });
75
+ */
76
+ addEventListener(target: any, type: string, handler: (event: Event) => void, options?: AddEventListenerOptions): void;
53
77
  /**
54
78
  * Abort the abort controller and execute all `onInvalidated` listeners.
55
79
  */
@@ -514,7 +538,7 @@ type EntrypointGroup = Entrypoint | Entrypoint[];
514
538
  */
515
539
  declare function clean(root?: string): Promise<void>;
516
540
 
517
- var version = "0.6.2";
541
+ var version = "0.6.3";
518
542
 
519
543
  declare function defineConfig(config: UserConfig): UserConfig;
520
544
 
package/dist/index.js CHANGED
@@ -2347,7 +2347,7 @@ async function clean(root = process.cwd()) {
2347
2347
  }
2348
2348
 
2349
2349
  // package.json
2350
- var version2 = "0.6.2";
2350
+ var version2 = "0.6.3";
2351
2351
 
2352
2352
  // src/core/utils/defineConfig.ts
2353
2353
  function defineConfig(config) {