@types/chrome 0.0.168 → 0.0.172

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. chrome/README.md +2 -2
  2. chrome/index.d.ts +42 -25
  3. chrome/package.json +2 -7
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: Mon, 06 Dec 2021 04:01:01 GMT
11
+ * Last updated: Thu, 23 Dec 2021 23:34:23 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), [Nicolas Rodriguez](https://github.com/nicolas377), and [Ido Salomon](https://github.com/idosal).
16
+ These definitions were written by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10), [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
@@ -2,7 +2,6 @@
2
2
  // Project: http://developer.chrome.com/extensions/
3
3
  // Definitions by: Matthew Kimber <https://github.com/matthewkimber>
4
4
  // otiai10 <https://github.com/otiai10>
5
- // couven92 <https://github.com/couven92>
6
5
  // RReverser <https://github.com/rreverser>
7
6
  // sreimer15 <https://github.com/sreimer15>
8
7
  // MatCarlson <https://github.com/MatCarlson>
@@ -1516,7 +1515,7 @@ declare namespace chrome.contextMenus {
1516
1515
  * Since Chrome 35.
1517
1516
  * One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements.
1518
1517
  */
1519
- mediaType?: string | undefined;
1518
+ mediaType?: 'image' | 'video' | 'audio' | undefined;
1520
1519
  /**
1521
1520
  * Optional.
1522
1521
  * Since Chrome 35.
@@ -1548,6 +1547,10 @@ declare namespace chrome.contextMenus {
1548
1547
  srcUrl?: string | undefined;
1549
1548
  }
1550
1549
 
1550
+ type ContextType = "all" | "page" | "frame" | "selection" | "link" | "editable" | "image" | "video" | "audio" | "launcher" | "browser_action" | "page_action" | "action";
1551
+
1552
+ type ContextItemType = "normal" | "checkbox" | "radio" | "separator";
1553
+
1551
1554
  export interface CreateProperties {
1552
1555
  /** Optional. Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see Match Patterns. */
1553
1556
  documentUrlPatterns?: string[] | undefined;
@@ -1556,7 +1559,7 @@ declare namespace chrome.contextMenus {
1556
1559
  /** Optional. The text to be displayed in the item; this is required unless type is 'separator'. When the context is 'selection', you can use %s within the string to show the selected text. For example, if this parameter's value is "Translate '%s' to Pig Latin" and the user selects the word "cool", the context menu item for the selection is "Translate 'cool' to Pig Latin". */
1557
1560
  title?: string | undefined;
1558
1561
  /** Optional. List of contexts this menu item will appear in. Defaults to ['page'] if not specified. */
1559
- contexts?: string[] | undefined;
1562
+ contexts?: ContextType | ContextType[] | undefined;
1560
1563
  /**
1561
1564
  * Optional.
1562
1565
  * Since Chrome 20.
@@ -1575,7 +1578,7 @@ declare namespace chrome.contextMenus {
1575
1578
  /** Optional. The ID of a parent menu item; this makes the item a child of a previously added item. */
1576
1579
  parentId?: any;
1577
1580
  /** Optional. The type of menu item. Defaults to 'normal' if not specified. */
1578
- type?: string | undefined;
1581
+ type?: ContextItemType | undefined;
1579
1582
  /**
1580
1583
  * Optional.
1581
1584
  * Since Chrome 21.
@@ -1594,14 +1597,14 @@ declare namespace chrome.contextMenus {
1594
1597
  documentUrlPatterns?: string[] | undefined;
1595
1598
  checked?: boolean | undefined;
1596
1599
  title?: string | undefined;
1597
- contexts?: string[] | undefined;
1600
+ contexts?: ContextType[] | undefined;
1598
1601
  /** Optional. Since Chrome 20. */
1599
1602
  enabled?: boolean | undefined;
1600
1603
  targetUrlPatterns?: string[] | undefined;
1601
1604
  onclick?: Function | undefined;
1602
1605
  /** Optional. Note: You cannot change an item to be a child of one of its own descendants. */
1603
1606
  parentId?: number | string;
1604
- type?: string | undefined;
1607
+ type?: ContextItemType | undefined;
1605
1608
  /**
1606
1609
  * Optional.
1607
1610
  * @since Chrome 62.
@@ -1628,10 +1631,9 @@ declare namespace chrome.contextMenus {
1628
1631
  /**
1629
1632
  * Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in chrome.runtime.lastError).
1630
1633
  * @param callback Called when the item has been created in the browser. If there were any problems creating the item, details will be available in chrome.runtime.lastError.
1631
- * If you specify the callback parameter, it should be a function that looks like this:
1632
- * function() {...};
1634
+ * @returns The ID of the newly created item.
1633
1635
  */
1634
- export function create(createProperties: CreateProperties, callback?: () => void): void;
1636
+ export function create(createProperties: CreateProperties, callback?: () => void): number | string;
1635
1637
  /**
1636
1638
  * Updates a previously created context menu item.
1637
1639
  * @param id The ID of the item to update.
@@ -5402,6 +5404,8 @@ declare namespace chrome.networking.config {
5402
5404
  * @since Chrome 28.
5403
5405
  */
5404
5406
  declare namespace chrome.notifications {
5407
+ export type TemplateType = "basic" | "image" | "list" | "progress";
5408
+
5405
5409
  export interface ButtonOptions {
5406
5410
  title: string;
5407
5411
  iconUrl?: string | undefined;
@@ -5414,19 +5418,7 @@ declare namespace chrome.notifications {
5414
5418
  message: string;
5415
5419
  }
5416
5420
 
5417
- export interface NotificationOptions {
5418
- /** Optional. Which type of notification to display. Required for notifications.create method. */
5419
- type?: string | undefined;
5420
- /**
5421
- * Optional.
5422
- * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
5423
- * 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.
5424
- */
5425
- iconUrl?: string | undefined;
5426
- /** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */
5427
- title?: string | undefined;
5428
- /** Optional. Main notification content. Required for notifications.create method. */
5429
- message?: string | undefined;
5421
+ export type NotificationOptions<T extends boolean = false> = {
5430
5422
  /**
5431
5423
  * Optional.
5432
5424
  * Alternate notification content with a lower-weight font.
@@ -5473,7 +5465,32 @@ declare namespace chrome.notifications {
5473
5465
  * @since Chrome 70
5474
5466
  */
5475
5467
  silent?: boolean | undefined;
5476
- }
5468
+ } & (T extends true ? {
5469
+ /**
5470
+ * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
5471
+ * 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.
5472
+ */
5473
+ iconUrl: string;
5474
+ /** Main notification content. Required for notifications.create method. */
5475
+ message: string;
5476
+ /** Which type of notification to display. Required for notifications.create method. */
5477
+ type: TemplateType;
5478
+ /** Title of the notification (e.g. sender name for email). Required for notifications.create method. */
5479
+ title: string;
5480
+ } : {
5481
+ /**
5482
+ * Optional.
5483
+ * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
5484
+ * 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.
5485
+ */
5486
+ iconUrl?: string | undefined;
5487
+ /** Optional. Main notification content. Required for notifications.create method. */
5488
+ message?: string | undefined;
5489
+ /** Optional. Which type of notification to display. Required for notifications.create method. */
5490
+ type?: TemplateType | undefined;
5491
+ /** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */
5492
+ title?: string | undefined;
5493
+ })
5477
5494
 
5478
5495
  export interface NotificationClosedEvent
5479
5496
  extends chrome.events.Event<(notificationId: string, byUser: boolean) => void> { }
@@ -5516,7 +5533,7 @@ declare namespace chrome.notifications {
5516
5533
  */
5517
5534
  export function create(
5518
5535
  notificationId: string,
5519
- options: NotificationOptions,
5536
+ options: NotificationOptions<true>,
5520
5537
  callback?: (notificationId: string) => void,
5521
5538
  ): void;
5522
5539
  /**
@@ -5529,7 +5546,7 @@ declare namespace chrome.notifications {
5529
5546
  * If you specify the callback parameter, it should be a function that looks like this:
5530
5547
  * function(string notificationId) {...};
5531
5548
  */
5532
- export function create(options: NotificationOptions, callback?: (notificationId: string) => void): void;
5549
+ export function create(options: NotificationOptions<true>, callback?: (notificationId: string) => void): void;
5533
5550
  /**
5534
5551
  * Updates an existing notification.
5535
5552
  * @param notificationId The id of the notification to be updated. This is returned by notifications.create method.
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.168",
3
+ "version": "0.0.172",
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",
@@ -15,11 +15,6 @@
15
15
  "url": "https://github.com/otiai10",
16
16
  "githubUsername": "otiai10"
17
17
  },
18
- {
19
- "name": "couven92",
20
- "url": "https://github.com/couven92",
21
- "githubUsername": "couven92"
22
- },
23
18
  {
24
19
  "name": "RReverser",
25
20
  "url": "https://github.com/rreverser",
@@ -103,6 +98,6 @@
103
98
  "@types/filesystem": "*",
104
99
  "@types/har-format": "*"
105
100
  },
106
- "typesPublisherContentHash": "fe256390c65c3ad9525bd7c17c2a1c984d604df3aef194fbd962b6126ade8cad",
101
+ "typesPublisherContentHash": "973f145197598c70e1e305ec6d5d91e58618d4e4b404c855315e4d4cea3f0890",
107
102
  "typeScriptVersion": "3.8"
108
103
  }