@types/chrome 0.0.191 → 0.0.194
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 +26 -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 13:32:28 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
@@ -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.
|
@@ -9349,7 +9351,7 @@ declare namespace chrome.tabs {
|
|
9349
9351
|
* Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a background page or popup view).
|
9350
9352
|
* @return The `getCurrent` method provides its result via callback or returned as a `Promise` (MV3 only).
|
9351
9353
|
*/
|
9352
|
-
export function getCurrent(): Promise<Tab>;
|
9354
|
+
export function getCurrent(): Promise<Tab | undefined>;
|
9353
9355
|
/**
|
9354
9356
|
* Gets the tab that is selected in the specified window.
|
9355
9357
|
* @deprecated since Chrome 33. Please use tabs.query {active: true}.
|
@@ -9563,7 +9565,7 @@ declare namespace chrome.tabs {
|
|
9563
9565
|
* 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
9566
|
* @since Chrome 20.
|
9565
9567
|
*/
|
9566
|
-
export function sendMessage<M = any, R = any>(tabId: number, message: M, responseCallback
|
9568
|
+
export function sendMessage<M = any, R = any>(tabId: number, message: M, responseCallback: (response: R) => void): void;
|
9567
9569
|
/**
|
9568
9570
|
* 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
9571
|
* @since Chrome 41.
|
@@ -9574,8 +9576,22 @@ declare namespace chrome.tabs {
|
|
9574
9576
|
tabId: number,
|
9575
9577
|
message: M,
|
9576
9578
|
options: MessageSendOptions,
|
9577
|
-
responseCallback
|
9579
|
+
responseCallback: (response: R) => void,
|
9578
9580
|
): void;
|
9581
|
+
/**
|
9582
|
+
* 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.
|
9583
|
+
* @since Chrome 99
|
9584
|
+
*/
|
9585
|
+
export function sendMessage<M = any, R = any>(tabId: number, message: M): Promise<R>;
|
9586
|
+
/**
|
9587
|
+
* 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.
|
9588
|
+
* @since Chrome 99
|
9589
|
+
*/
|
9590
|
+
export function sendMessage<M = any, R = any>(
|
9591
|
+
tabId: number,
|
9592
|
+
message: M,
|
9593
|
+
options: MessageSendOptions
|
9594
|
+
): Promise<R>;
|
9579
9595
|
/**
|
9580
9596
|
* 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
9597
|
* @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.194",
|
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": "349e3bb45667342e85a56de4b8c839bb3051ba69d3ce9bcca7a278db4c4ca645",
|
97
97
|
"typeScriptVersion": "4.0"
|
98
98
|
}
|