@wxt-dev/browser 0.2.0 → 0.2.2

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/gen/index.d.ts +46 -13
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wxt-dev/browser",
3
3
  "description": "Provides a cross-browser API for using extension APIs and types based on @types/chrome",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
7
7
  "types": "src/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "src"
26
26
  ],
27
27
  "devDependencies": {
28
- "@types/chrome": "0.2.0",
28
+ "@types/chrome": "0.2.2",
29
29
  "@types/node": "^20.17.6",
30
30
  "nano-spawn": "^2.0.0",
31
31
  "typescript": "^6.0.3",
@@ -383,22 +383,53 @@ export namespace Browser {
383
383
  * Permissions: "alarms"
384
384
  */
385
385
  export namespace alarms {
386
- interface AlarmCreateInfo {
387
- /** Length of time in minutes after which the {@link onAlarm} event should fire. */
388
- delayInMinutes?: number | undefined;
389
- /** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
390
- periodInMinutes?: number | undefined;
391
- /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
392
- when?: number | undefined;
393
- }
386
+ type AlarmCreateInfo =
387
+ & {
388
+ /**
389
+ * Whether the alarm should persist across sessions (browser restarts). In Chrome, this defaults to true to match historical behavior, but you should set this explicitly to maximize compatibility across browsers.
390
+ * @since Chrome 150
391
+ */
392
+ persistAcrossSessions?: boolean | undefined;
393
+ }
394
+ & (
395
+ | {
396
+ /** Length of time in minutes after which the {@link onAlarm} event should fire. */
397
+ delayInMinutes: number;
398
+ /** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
399
+ periodInMinutes?: number | undefined;
400
+ /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
401
+ when?: never | undefined;
402
+ }
403
+ | {
404
+ /** Length of time in minutes after which the {@link onAlarm} event should fire. */
405
+ delayInMinutes?: number | undefined;
406
+ /** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
407
+ periodInMinutes: number;
408
+ /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
409
+ when?: number | undefined;
410
+ }
411
+ | {
412
+ /** Length of time in minutes after which the {@link onAlarm} event should fire. */
413
+ delayInMinutes?: never | undefined;
414
+ /** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
415
+ periodInMinutes?: number | undefined;
416
+ /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
417
+ when: number;
418
+ }
419
+ );
394
420
 
395
421
  interface Alarm {
422
+ /** Name of this alarm. */
423
+ name: string;
396
424
  /** If not null, the alarm is a repeating alarm and will fire again in `periodInMinutes` minutes. */
397
425
  periodInMinutes?: number;
426
+ /**
427
+ * Whether the alarm should persist across sessions (browser restarts).
428
+ * @since Chrome 150
429
+ */
430
+ persistAcrossSessions: boolean;
398
431
  /** Time at which this alarm was scheduled to fire, in milliseconds past the epoch (e.g. `Date.now() + n`). For performance reasons, the alarm may have been delayed an arbitrary amount beyond this. */
399
432
  scheduledTime: number;
400
- /** Name of this alarm. */
401
- name: string;
402
433
  }
403
434
 
404
435
  /**
@@ -7606,7 +7637,7 @@ export namespace Browser {
7606
7637
  * Creates a new offscreen document for the extension.
7607
7638
  * @param parameters The parameters describing the offscreen document to create.
7608
7639
  *
7609
- * Can return its result via Promise in Manifest V3.
7640
+ * Can return its result via Promise.
7610
7641
  */
7611
7642
  function createDocument(parameters: CreateParameters): Promise<void>;
7612
7643
  function createDocument(parameters: CreateParameters, callback: () => void): void;
@@ -7614,7 +7645,7 @@ export namespace Browser {
7614
7645
  /**
7615
7646
  * Closes the currently-open offscreen document for the extension.
7616
7647
  *
7617
- * Can return its result via Promise in Manifest V3.
7648
+ * Can return its result via Promise.
7618
7649
  */
7619
7650
  function closeDocument(): Promise<void>;
7620
7651
  function closeDocument(callback: () => void): void;
@@ -7622,7 +7653,8 @@ export namespace Browser {
7622
7653
  /**
7623
7654
  * Determines whether the extension has an active document.
7624
7655
  *
7625
- * Can return its result via Promise in Manifest V3.
7656
+ * Can return its result via Promise.
7657
+ * @since Chrome 150
7626
7658
  */
7627
7659
  function hasDocument(): Promise<boolean>;
7628
7660
  function hasDocument(callback: (result: boolean) => void): void;
@@ -9184,6 +9216,7 @@ export namespace Browser {
9184
9216
  | "identity"
9185
9217
  | "identity.email"
9186
9218
  | "idle"
9219
+ | "input"
9187
9220
  | "loginState"
9188
9221
  | "management"
9189
9222
  | "nativeMessaging"