@types/chrome 0.0.166 → 0.0.170
Sign up to get free protection for your applications and to get access to all the features.
- chrome/README.md +1 -1
- chrome/index.d.ts +55 -25
- chrome/package.json +2 -2
chrome/README.md
CHANGED
@@ -8,7 +8,7 @@ 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:
|
11
|
+
* Last updated: Sun, 12 Dec 2021 06:31:08 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
|
|
chrome/index.d.ts
CHANGED
@@ -775,7 +775,7 @@ declare namespace chrome.browserAction {
|
|
775
775
|
|
776
776
|
export interface BadgeTextDetails {
|
777
777
|
/** Any number of characters can be passed, but only about four can fit in the space. */
|
778
|
-
text?: string | null;
|
778
|
+
text?: string | null | undefined;
|
779
779
|
/** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
|
780
780
|
tabId?: number | undefined;
|
781
781
|
}
|
@@ -1516,7 +1516,7 @@ declare namespace chrome.contextMenus {
|
|
1516
1516
|
* Since Chrome 35.
|
1517
1517
|
* One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements.
|
1518
1518
|
*/
|
1519
|
-
mediaType?:
|
1519
|
+
mediaType?: 'image' | 'video' | 'audio' | undefined;
|
1520
1520
|
/**
|
1521
1521
|
* Optional.
|
1522
1522
|
* Since Chrome 35.
|
@@ -1548,6 +1548,10 @@ declare namespace chrome.contextMenus {
|
|
1548
1548
|
srcUrl?: string | undefined;
|
1549
1549
|
}
|
1550
1550
|
|
1551
|
+
type ContextType = "all" | "page" | "frame" | "selection" | "link" | "editable" | "image" | "video" | "audio" | "launcher" | "browser_action" | "page_action" | "action";
|
1552
|
+
|
1553
|
+
type ContextItemType = "normal" | "checkbox" | "radio" | "separator";
|
1554
|
+
|
1551
1555
|
export interface CreateProperties {
|
1552
1556
|
/** 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
1557
|
documentUrlPatterns?: string[] | undefined;
|
@@ -1556,7 +1560,7 @@ declare namespace chrome.contextMenus {
|
|
1556
1560
|
/** 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
1561
|
title?: string | undefined;
|
1558
1562
|
/** Optional. List of contexts this menu item will appear in. Defaults to ['page'] if not specified. */
|
1559
|
-
contexts?:
|
1563
|
+
contexts?: ContextType | ContextType[] | undefined;
|
1560
1564
|
/**
|
1561
1565
|
* Optional.
|
1562
1566
|
* Since Chrome 20.
|
@@ -1575,7 +1579,7 @@ declare namespace chrome.contextMenus {
|
|
1575
1579
|
/** Optional. The ID of a parent menu item; this makes the item a child of a previously added item. */
|
1576
1580
|
parentId?: any;
|
1577
1581
|
/** Optional. The type of menu item. Defaults to 'normal' if not specified. */
|
1578
|
-
type?:
|
1582
|
+
type?: ContextItemType | undefined;
|
1579
1583
|
/**
|
1580
1584
|
* Optional.
|
1581
1585
|
* Since Chrome 21.
|
@@ -1594,14 +1598,14 @@ declare namespace chrome.contextMenus {
|
|
1594
1598
|
documentUrlPatterns?: string[] | undefined;
|
1595
1599
|
checked?: boolean | undefined;
|
1596
1600
|
title?: string | undefined;
|
1597
|
-
contexts?:
|
1601
|
+
contexts?: ContextType[] | undefined;
|
1598
1602
|
/** Optional. Since Chrome 20. */
|
1599
1603
|
enabled?: boolean | undefined;
|
1600
1604
|
targetUrlPatterns?: string[] | undefined;
|
1601
1605
|
onclick?: Function | undefined;
|
1602
1606
|
/** Optional. Note: You cannot change an item to be a child of one of its own descendants. */
|
1603
1607
|
parentId?: number | string;
|
1604
|
-
type?:
|
1608
|
+
type?: ContextItemType | undefined;
|
1605
1609
|
/**
|
1606
1610
|
* Optional.
|
1607
1611
|
* @since Chrome 62.
|
@@ -5402,6 +5406,8 @@ declare namespace chrome.networking.config {
|
|
5402
5406
|
* @since Chrome 28.
|
5403
5407
|
*/
|
5404
5408
|
declare namespace chrome.notifications {
|
5409
|
+
export type TemplateType = "basic" | "image" | "list" | "progress";
|
5410
|
+
|
5405
5411
|
export interface ButtonOptions {
|
5406
5412
|
title: string;
|
5407
5413
|
iconUrl?: string | undefined;
|
@@ -5414,19 +5420,7 @@ declare namespace chrome.notifications {
|
|
5414
5420
|
message: string;
|
5415
5421
|
}
|
5416
5422
|
|
5417
|
-
export
|
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;
|
5423
|
+
export type NotificationOptions<T extends boolean = false> = {
|
5430
5424
|
/**
|
5431
5425
|
* Optional.
|
5432
5426
|
* Alternate notification content with a lower-weight font.
|
@@ -5473,7 +5467,32 @@ declare namespace chrome.notifications {
|
|
5473
5467
|
* @since Chrome 70
|
5474
5468
|
*/
|
5475
5469
|
silent?: boolean | undefined;
|
5476
|
-
}
|
5470
|
+
} & (T extends true ? {
|
5471
|
+
/**
|
5472
|
+
* A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
|
5473
|
+
* 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.
|
5474
|
+
*/
|
5475
|
+
iconUrl: string;
|
5476
|
+
/** Main notification content. Required for notifications.create method. */
|
5477
|
+
message: string;
|
5478
|
+
/** Which type of notification to display. Required for notifications.create method. */
|
5479
|
+
type: TemplateType;
|
5480
|
+
/** Title of the notification (e.g. sender name for email). Required for notifications.create method. */
|
5481
|
+
title: string;
|
5482
|
+
} : {
|
5483
|
+
/**
|
5484
|
+
* Optional.
|
5485
|
+
* A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
|
5486
|
+
* 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.
|
5487
|
+
*/
|
5488
|
+
iconUrl?: string | undefined;
|
5489
|
+
/** Optional. Main notification content. Required for notifications.create method. */
|
5490
|
+
message?: string | undefined;
|
5491
|
+
/** Optional. Which type of notification to display. Required for notifications.create method. */
|
5492
|
+
type?: TemplateType | undefined;
|
5493
|
+
/** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */
|
5494
|
+
title?: string | undefined;
|
5495
|
+
})
|
5477
5496
|
|
5478
5497
|
export interface NotificationClosedEvent
|
5479
5498
|
extends chrome.events.Event<(notificationId: string, byUser: boolean) => void> { }
|
@@ -5516,7 +5535,7 @@ declare namespace chrome.notifications {
|
|
5516
5535
|
*/
|
5517
5536
|
export function create(
|
5518
5537
|
notificationId: string,
|
5519
|
-
options: NotificationOptions
|
5538
|
+
options: NotificationOptions<true>,
|
5520
5539
|
callback?: (notificationId: string) => void,
|
5521
5540
|
): void;
|
5522
5541
|
/**
|
@@ -5529,7 +5548,7 @@ declare namespace chrome.notifications {
|
|
5529
5548
|
* If you specify the callback parameter, it should be a function that looks like this:
|
5530
5549
|
* function(string notificationId) {...};
|
5531
5550
|
*/
|
5532
|
-
export function create(options: NotificationOptions
|
5551
|
+
export function create(options: NotificationOptions<true>, callback?: (notificationId: string) => void): void;
|
5533
5552
|
/**
|
5534
5553
|
* Updates an existing notification.
|
5535
5554
|
* @param notificationId The id of the notification to be updated. This is returned by notifications.create method.
|
@@ -6488,6 +6507,13 @@ declare namespace chrome.runtime {
|
|
6488
6507
|
export type PlatformArch = 'arm' | 'arm64' | 'x86-32' | 'x86-64' | 'mips' | 'mips64';
|
6489
6508
|
/** https://developer.chrome.com/docs/extensions/reference/runtime/#type-PlatformNaclArch */
|
6490
6509
|
export type PlatformNaclArch = 'arm' | 'x86-32' | 'x86-64' | 'mips' | 'mips64';
|
6510
|
+
/** https://developer.chrome.com/docs/extensions/reference/runtime/#type-OnInstalledReason */
|
6511
|
+
export enum OnInstalledReason {
|
6512
|
+
INSTALL = 'install',
|
6513
|
+
UPDATE = 'update',
|
6514
|
+
CHROME_UPDATE = 'chrome_update',
|
6515
|
+
SHARED_MODULE_UPDATE = 'shared_module_update'
|
6516
|
+
}
|
6491
6517
|
|
6492
6518
|
export interface LastError {
|
6493
6519
|
/** Optional. Details about the error which occurred. */
|
@@ -6502,9 +6528,8 @@ declare namespace chrome.runtime {
|
|
6502
6528
|
export interface InstalledDetails {
|
6503
6529
|
/**
|
6504
6530
|
* The reason that this event is being dispatched.
|
6505
|
-
* One of: "install", "update", "chrome_update", or "shared_module_update"
|
6506
6531
|
*/
|
6507
|
-
reason:
|
6532
|
+
reason: OnInstalledReason;
|
6508
6533
|
/**
|
6509
6534
|
* Optional.
|
6510
6535
|
* Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is 'update'.
|
@@ -7127,7 +7152,10 @@ declare namespace chrome.runtime {
|
|
7127
7152
|
declare namespace chrome.scripting {
|
7128
7153
|
|
7129
7154
|
/* The CSS style origin for a style change. */
|
7130
|
-
export type StyleOrigin =
|
7155
|
+
export type StyleOrigin = 'AUTHOR' | 'USER';
|
7156
|
+
|
7157
|
+
/* The JavaScript world for a script to execute within. */
|
7158
|
+
export type ExecutionWorld = 'ISOLATED' | 'MAIN';
|
7131
7159
|
|
7132
7160
|
export interface InjectionResult {
|
7133
7161
|
/* The frame associated with the injection. */
|
@@ -7159,6 +7187,8 @@ declare namespace chrome.scripting {
|
|
7159
7187
|
export type ScriptInjection<Args extends any[] = []> = {
|
7160
7188
|
/* Details specifying the target into which to inject the script. */
|
7161
7189
|
target: InjectionTarget;
|
7190
|
+
/* The JavaScript world for a script to execute within. */
|
7191
|
+
world?: ExecutionWorld;
|
7162
7192
|
} & ({
|
7163
7193
|
/* 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. */
|
7164
7194
|
files: string[];
|
chrome/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/chrome",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.170",
|
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",
|
@@ -103,6 +103,6 @@
|
|
103
103
|
"@types/filesystem": "*",
|
104
104
|
"@types/har-format": "*"
|
105
105
|
},
|
106
|
-
"typesPublisherContentHash": "
|
106
|
+
"typesPublisherContentHash": "7b8a3b7326117b80093beaf50ba7c6f0b7dc907c6c86559c665d9a422daa47ac",
|
107
107
|
"typeScriptVersion": "3.8"
|
108
108
|
}
|