@types/chrome 0.0.192 → 0.0.195
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 +37 -10
- 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: Fri, 19 Aug 2022 18:02:30 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
@@ -2469,7 +2469,7 @@ declare namespace chrome.devtools.inspectedWindow {
|
|
2469
2469
|
export var tabId: number;
|
2470
2470
|
|
2471
2471
|
/** Reloads the inspected page. */
|
2472
|
-
export function reload(reloadOptions
|
2472
|
+
export function reload(reloadOptions?: ReloadOptions): void;
|
2473
2473
|
/**
|
2474
2474
|
* Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the result parameter of the callback is undefined. In the case of a DevTools-side error, the isException parameter is non-null and has isError set to true and code set to an error code. In the case of a JavaScript error, isException is set to true and value is set to the string value of thrown object.
|
2475
2475
|
* @param expression An expression to evaluate.
|
@@ -7570,11 +7570,11 @@ declare namespace chrome.scripting {
|
|
7570
7570
|
/* The JavaScript world for a script to execute within. */
|
7571
7571
|
export type ExecutionWorld = 'ISOLATED' | 'MAIN';
|
7572
7572
|
|
7573
|
-
export interface InjectionResult {
|
7573
|
+
export interface InjectionResult<T> {
|
7574
7574
|
/* The frame associated with the injection. */
|
7575
7575
|
frameId: number;
|
7576
7576
|
/* The result of the script execution. */
|
7577
|
-
result
|
7577
|
+
result: T;
|
7578
7578
|
}
|
7579
7579
|
|
7580
7580
|
export interface InjectionTarget {
|
@@ -7597,7 +7597,7 @@ declare namespace chrome.scripting {
|
|
7597
7597
|
target: InjectionTarget;
|
7598
7598
|
}
|
7599
7599
|
|
7600
|
-
export type ScriptInjection<Args extends any[]> = {
|
7600
|
+
export type ScriptInjection<Args extends any[], Result> = {
|
7601
7601
|
/* Details specifying the target into which to inject the script. */
|
7602
7602
|
target: InjectionTarget;
|
7603
7603
|
/* The JavaScript world for a script to execute within. */
|
@@ -7607,21 +7607,23 @@ declare namespace chrome.scripting {
|
|
7607
7607
|
files: string[];
|
7608
7608
|
} | ({
|
7609
7609
|
/* A JavaScript function to inject. This function will be serialized, and then deserialized for injection. This means that any bound parameters and execution context will be lost. Exactly one of files and function must be specified. */
|
7610
|
-
func: () =>
|
7610
|
+
func: () => Result;
|
7611
7611
|
} | {
|
7612
7612
|
/* A JavaScript function to inject. This function will be serialized, and then deserialized for injection. This means that any bound parameters and execution context will be lost. Exactly one of files and function must be specified. */
|
7613
|
-
func: (...args: Args) =>
|
7613
|
+
func: (...args: Args) => Result;
|
7614
7614
|
/* The arguments to carry into a provided function. This is only valid if the func parameter is specified. These arguments must be JSON-serializable. */
|
7615
7615
|
args: Args;
|
7616
7616
|
}))
|
7617
7617
|
|
7618
|
+
type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
|
7619
|
+
|
7618
7620
|
/**
|
7619
7621
|
* Injects a script into a target context. The script will be run at document_end.
|
7620
7622
|
* @param injection
|
7621
7623
|
* The details of the script which to inject.
|
7622
7624
|
* @return The `executeScript` method provides its result via callback or returned as a `Promise` (MV3 only). The resulting array contains the result of execution for each frame where the injection succeeded.
|
7623
7625
|
*/
|
7624
|
-
export function executeScript<Args extends any[]>(injection: ScriptInjection<Args>): Promise<InjectionResult[]>;
|
7626
|
+
export function executeScript<Args extends any[], Result>(injection: ScriptInjection<Args, Result>): Promise<InjectionResult<Awaited<Result>>[]>;
|
7625
7627
|
|
7626
7628
|
/**
|
7627
7629
|
* Injects a script into a target context. The script will be run at document_end.
|
@@ -7630,7 +7632,7 @@ declare namespace chrome.scripting {
|
|
7630
7632
|
* @param callback
|
7631
7633
|
* Invoked upon completion of the injection. The resulting array contains the result of execution for each frame where the injection succeeded.
|
7632
7634
|
*/
|
7633
|
-
export function executeScript<Args extends any[]>(injection: ScriptInjection<Args>, callback?: (results: InjectionResult[]) => void): void;
|
7635
|
+
export function executeScript<Args extends any[], Result>(injection: ScriptInjection<Args, Result>, callback?: (results: InjectionResult<Awaited<Result>>[]) => void): void;
|
7634
7636
|
|
7635
7637
|
/**
|
7636
7638
|
* Inserts a CSS stylesheet into a target context. If multiple frames are specified, unsuccessful injections are ignored.
|
@@ -7852,6 +7854,14 @@ declare namespace chrome.storage {
|
|
7852
7854
|
* Parameter items: Object with items in their key-value mappings.
|
7853
7855
|
*/
|
7854
7856
|
get(keys: string | string[] | { [key: string]: any } | null, callback: (items: { [key: string]: any }) => void): void;
|
7857
|
+
/**
|
7858
|
+
* Fired when one or more items change within this storage area.
|
7859
|
+
* @param keys A single key to get, list of keys to get, or a dictionary specifying default values.
|
7860
|
+
* An empty list or object will return an empty result object. Pass in null to get the entire contents of storage.
|
7861
|
+
* @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
|
7862
|
+
* Parameter items: Object with items in their key-value mappings.
|
7863
|
+
*/
|
7864
|
+
onChanged: StorageAreaChangedEvent;
|
7855
7865
|
}
|
7856
7866
|
|
7857
7867
|
export interface StorageChange {
|
@@ -7893,6 +7903,9 @@ declare namespace chrome.storage {
|
|
7893
7903
|
QUOTA_BYTES: number;
|
7894
7904
|
}
|
7895
7905
|
|
7906
|
+
export interface StorageAreaChangedEvent
|
7907
|
+
extends chrome.events.Event<(changes: { [key: string]: StorageChange }) => void> { }
|
7908
|
+
|
7896
7909
|
type AreaName = keyof Pick<typeof chrome.storage, 'sync' | 'local' | 'managed' | 'session'>;
|
7897
7910
|
export interface StorageChangedEvent
|
7898
7911
|
extends chrome.events.Event<(changes: { [key: string]: StorageChange }, areaName: AreaName) => void> { }
|
@@ -9563,7 +9576,7 @@ declare namespace chrome.tabs {
|
|
9563
9576
|
* Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension.
|
9564
9577
|
* @since Chrome 20.
|
9565
9578
|
*/
|
9566
|
-
export function sendMessage<M = any, R = any>(tabId: number, message: M, responseCallback
|
9579
|
+
export function sendMessage<M = any, R = any>(tabId: number, message: M, responseCallback: (response: R) => void): void;
|
9567
9580
|
/**
|
9568
9581
|
* Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension.
|
9569
9582
|
* @since Chrome 41.
|
@@ -9574,8 +9587,22 @@ declare namespace chrome.tabs {
|
|
9574
9587
|
tabId: number,
|
9575
9588
|
message: M,
|
9576
9589
|
options: MessageSendOptions,
|
9577
|
-
responseCallback
|
9590
|
+
responseCallback: (response: R) => void,
|
9578
9591
|
): void;
|
9592
|
+
/**
|
9593
|
+
* Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension.
|
9594
|
+
* @since Chrome 99
|
9595
|
+
*/
|
9596
|
+
export function sendMessage<M = any, R = any>(tabId: number, message: M): Promise<R>;
|
9597
|
+
/**
|
9598
|
+
* Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension.
|
9599
|
+
* @since Chrome 99
|
9600
|
+
*/
|
9601
|
+
export function sendMessage<M = any, R = any>(
|
9602
|
+
tabId: number,
|
9603
|
+
message: M,
|
9604
|
+
options: MessageSendOptions
|
9605
|
+
): Promise<R>;
|
9579
9606
|
/**
|
9580
9607
|
* Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The extension.onRequest event is fired in each content script running in the specified tab for the current extension.
|
9581
9608
|
* @deprecated since Chrome 33. Please use runtime.sendMessage.
|
chrome/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/chrome",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.195",
|
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",
|
@@ -93,6 +93,6 @@
|
|
93
93
|
"@types/filesystem": "*",
|
94
94
|
"@types/har-format": "*"
|
95
95
|
},
|
96
|
-
"typesPublisherContentHash": "
|
96
|
+
"typesPublisherContentHash": "8ff0cf531656b035cce43c232164d7453600f299b036db13715cbf871239332f",
|
97
97
|
"typeScriptVersion": "4.0"
|
98
98
|
}
|