@types/chrome 0.0.165 → 0.0.169

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 (3) hide show
  1. chrome/README.md +2 -2
  2. chrome/index.d.ts +47 -20
  3. chrome/package.json +7 -2
chrome/README.md CHANGED
@@ -8,9 +8,9 @@ This package contains type definitions for Chrome extension development (http://
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 30 Nov 2021 20:01:03 GMT
11
+ * Last updated: Thu, 09 Dec 2021 19:01:03 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
  * Global values: `chrome`
14
14
 
15
15
  # Credits
16
- These definitions were written by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10), [couven92](https://github.com/couven92), [RReverser](https://github.com/rreverser), [sreimer15](https://github.com/sreimer15), [MatCarlson](https://github.com/MatCarlson), [ekinsol](https://github.com/ekinsol), [Thierry Régagnon](https://github.com/tregagnon), [Brian Wilson](https://github.com/echoabstract), [Sebastiaan Pasma](https://github.com/spasma), [bdbai](https://github.com/bdbai), [pokutuna](https://github.com/pokutuna), [Jason Xian](https://github.com/JasonXian), [userTim](https://github.com/usertim), [Idan Zeierman](https://github.com/idan315), and [Nicolas Rodriguez](https://github.com/nicolas377).
16
+ These definitions were written by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10), [couven92](https://github.com/couven92), [RReverser](https://github.com/rreverser), [sreimer15](https://github.com/sreimer15), [MatCarlson](https://github.com/MatCarlson), [ekinsol](https://github.com/ekinsol), [Thierry Régagnon](https://github.com/tregagnon), [Brian Wilson](https://github.com/echoabstract), [Sebastiaan Pasma](https://github.com/spasma), [bdbai](https://github.com/bdbai), [pokutuna](https://github.com/pokutuna), [Jason Xian](https://github.com/JasonXian), [userTim](https://github.com/usertim), [Idan Zeierman](https://github.com/idan315), [Nicolas Rodriguez](https://github.com/nicolas377), and [Ido Salomon](https://github.com/idosal).
chrome/index.d.ts CHANGED
@@ -16,6 +16,7 @@
16
16
  // userTim <https://github.com/usertim>
17
17
  // Idan Zeierman <https://github.com/idan315>
18
18
  // Nicolas Rodriguez <https://github.com/nicolas377>
19
+ // Ido Salomon <https://github.com/idosal>
19
20
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
20
21
  // TypeScript Version: 2.4
21
22
 
@@ -774,7 +775,7 @@ declare namespace chrome.browserAction {
774
775
 
775
776
  export interface BadgeTextDetails {
776
777
  /** Any number of characters can be passed, but only about four can fit in the space. */
777
- text?: string | null;
778
+ text?: string | null | undefined;
778
779
  /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
779
780
  tabId?: number | undefined;
780
781
  }
@@ -5401,6 +5402,8 @@ declare namespace chrome.networking.config {
5401
5402
  * @since Chrome 28.
5402
5403
  */
5403
5404
  declare namespace chrome.notifications {
5405
+ export type TemplateType = "basic" | "image" | "list" | "progress";
5406
+
5404
5407
  export interface ButtonOptions {
5405
5408
  title: string;
5406
5409
  iconUrl?: string | undefined;
@@ -5413,19 +5416,7 @@ declare namespace chrome.notifications {
5413
5416
  message: string;
5414
5417
  }
5415
5418
 
5416
- export interface NotificationOptions {
5417
- /** Optional. Which type of notification to display. Required for notifications.create method. */
5418
- type?: string | undefined;
5419
- /**
5420
- * Optional.
5421
- * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
5422
- * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file Required for notifications.create method.
5423
- */
5424
- iconUrl?: string | undefined;
5425
- /** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */
5426
- title?: string | undefined;
5427
- /** Optional. Main notification content. Required for notifications.create method. */
5428
- message?: string | undefined;
5419
+ export type NotificationOptions<T extends boolean = false> = {
5429
5420
  /**
5430
5421
  * Optional.
5431
5422
  * Alternate notification content with a lower-weight font.
@@ -5472,7 +5463,32 @@ declare namespace chrome.notifications {
5472
5463
  * @since Chrome 70
5473
5464
  */
5474
5465
  silent?: boolean | undefined;
5475
- }
5466
+ } & (T extends true ? {
5467
+ /**
5468
+ * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
5469
+ * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file. Required for notifications.create method.
5470
+ */
5471
+ iconUrl: string;
5472
+ /** Main notification content. Required for notifications.create method. */
5473
+ message: string;
5474
+ /** Which type of notification to display. Required for notifications.create method. */
5475
+ type: TemplateType;
5476
+ /** Title of the notification (e.g. sender name for email). Required for notifications.create method. */
5477
+ title: string;
5478
+ } : {
5479
+ /**
5480
+ * Optional.
5481
+ * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
5482
+ * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file. Required for notifications.create method.
5483
+ */
5484
+ iconUrl?: string | undefined;
5485
+ /** Optional. Main notification content. Required for notifications.create method. */
5486
+ message?: string | undefined;
5487
+ /** Optional. Which type of notification to display. Required for notifications.create method. */
5488
+ type?: TemplateType | undefined;
5489
+ /** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */
5490
+ title?: string | undefined;
5491
+ })
5476
5492
 
5477
5493
  export interface NotificationClosedEvent
5478
5494
  extends chrome.events.Event<(notificationId: string, byUser: boolean) => void> { }
@@ -5515,7 +5531,7 @@ declare namespace chrome.notifications {
5515
5531
  */
5516
5532
  export function create(
5517
5533
  notificationId: string,
5518
- options: NotificationOptions,
5534
+ options: NotificationOptions<true>,
5519
5535
  callback?: (notificationId: string) => void,
5520
5536
  ): void;
5521
5537
  /**
@@ -5528,7 +5544,7 @@ declare namespace chrome.notifications {
5528
5544
  * If you specify the callback parameter, it should be a function that looks like this:
5529
5545
  * function(string notificationId) {...};
5530
5546
  */
5531
- export function create(options: NotificationOptions, callback?: (notificationId: string) => void): void;
5547
+ export function create(options: NotificationOptions<true>, callback?: (notificationId: string) => void): void;
5532
5548
  /**
5533
5549
  * Updates an existing notification.
5534
5550
  * @param notificationId The id of the notification to be updated. This is returned by notifications.create method.
@@ -6487,6 +6503,13 @@ declare namespace chrome.runtime {
6487
6503
  export type PlatformArch = 'arm' | 'arm64' | 'x86-32' | 'x86-64' | 'mips' | 'mips64';
6488
6504
  /** https://developer.chrome.com/docs/extensions/reference/runtime/#type-PlatformNaclArch */
6489
6505
  export type PlatformNaclArch = 'arm' | 'x86-32' | 'x86-64' | 'mips' | 'mips64';
6506
+ /** https://developer.chrome.com/docs/extensions/reference/runtime/#type-OnInstalledReason */
6507
+ export enum OnInstalledReason {
6508
+ INSTALL = 'install',
6509
+ UPDATE = 'update',
6510
+ CHROME_UPDATE = 'chrome_update',
6511
+ SHARED_MODULE_UPDATE = 'shared_module_update'
6512
+ }
6490
6513
 
6491
6514
  export interface LastError {
6492
6515
  /** Optional. Details about the error which occurred. */
@@ -6501,9 +6524,8 @@ declare namespace chrome.runtime {
6501
6524
  export interface InstalledDetails {
6502
6525
  /**
6503
6526
  * The reason that this event is being dispatched.
6504
- * One of: "install", "update", "chrome_update", or "shared_module_update"
6505
6527
  */
6506
- reason: string;
6528
+ reason: OnInstalledReason;
6507
6529
  /**
6508
6530
  * Optional.
6509
6531
  * Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is 'update'.
@@ -7126,7 +7148,10 @@ declare namespace chrome.runtime {
7126
7148
  declare namespace chrome.scripting {
7127
7149
 
7128
7150
  /* The CSS style origin for a style change. */
7129
- export type StyleOrigin = "AUTHOR" | "USER";
7151
+ export type StyleOrigin = 'AUTHOR' | 'USER';
7152
+
7153
+ /* The JavaScript world for a script to execute within. */
7154
+ export type ExecutionWorld = 'ISOLATED' | 'MAIN';
7130
7155
 
7131
7156
  export interface InjectionResult {
7132
7157
  /* The frame associated with the injection. */
@@ -7158,6 +7183,8 @@ declare namespace chrome.scripting {
7158
7183
  export type ScriptInjection<Args extends any[] = []> = {
7159
7184
  /* Details specifying the target into which to inject the script. */
7160
7185
  target: InjectionTarget;
7186
+ /* The JavaScript world for a script to execute within. */
7187
+ world?: ExecutionWorld;
7161
7188
  } & ({
7162
7189
  /* The path of the JS files to inject, relative to the extension's root directory. NOTE: Currently a maximum of one file is supported. Exactly one of files and function must be specified. */
7163
7190
  files: string[];
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.165",
3
+ "version": "0.0.169",
4
4
  "description": "TypeScript definitions for Chrome extension development",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -84,6 +84,11 @@
84
84
  "name": "Nicolas Rodriguez",
85
85
  "url": "https://github.com/nicolas377",
86
86
  "githubUsername": "nicolas377"
87
+ },
88
+ {
89
+ "name": "Ido Salomon",
90
+ "url": "https://github.com/idosal",
91
+ "githubUsername": "idosal"
87
92
  }
88
93
  ],
89
94
  "main": "",
@@ -98,6 +103,6 @@
98
103
  "@types/filesystem": "*",
99
104
  "@types/har-format": "*"
100
105
  },
101
- "typesPublisherContentHash": "4a8618393a67775341d870f5bf2ae67d7e3e8cb773cc49410fffbe1a00bae61f",
106
+ "typesPublisherContentHash": "602536495e691a80cf6e4d822b17751d3f2615eebca8617ae606281fe7279afc",
102
107
  "typeScriptVersion": "3.8"
103
108
  }