@types/chrome 0.0.192 → 0.0.193
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 +9 -7
- 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: Tue, 05 Jul 2022 00:02:16 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.
|
chrome/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/chrome",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.193",
|
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": "5b4b19a45af72fa27d09cf5ab83b562d2063984b64c182f7836f54e52c39561e",
|
97
97
|
"typeScriptVersion": "4.0"
|
98
98
|
}
|