@types/chrome 0.0.180 → 0.0.183
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 +75 -33
- 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: Tue,
|
11
|
+
* Last updated: Tue, 26 Apr 2022 11:01:42 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
@@ -1671,7 +1671,7 @@ declare namespace chrome.contextMenus {
|
|
1671
1671
|
wasChecked?: boolean | undefined;
|
1672
1672
|
/**
|
1673
1673
|
* Since Chrome 35.
|
1674
|
-
* The URL of the page where the menu item was clicked. This property is not set if the click
|
1674
|
+
* The URL of the page where the menu item was clicked. This property is not set if the click occurred in a context where there is no current page, such as in a launcher context menu.
|
1675
1675
|
*/
|
1676
1676
|
pageUrl: string;
|
1677
1677
|
/**
|
@@ -3421,15 +3421,8 @@ declare namespace chrome.events {
|
|
3421
3421
|
originAndPathMatches?: string | undefined;
|
3422
3422
|
}
|
3423
3423
|
|
3424
|
-
|
3425
|
-
|
3426
|
-
/**
|
3427
|
-
* Registers an event listener callback to an event.
|
3428
|
-
* @param callback Called when an event occurs. The parameters of this function depend on the type of event.
|
3429
|
-
* The callback parameter should be a function that looks like this:
|
3430
|
-
* function() {...};
|
3431
|
-
*/
|
3432
|
-
addListener(callback: T): void;
|
3424
|
+
export interface BaseEvent<T extends Function> {
|
3425
|
+
addListener(callback: T, filter?: webRequest.RequestFilter): void;
|
3433
3426
|
/**
|
3434
3427
|
* Returns currently registered rules.
|
3435
3428
|
* @param callback Called with registered rules.
|
@@ -3485,6 +3478,20 @@ declare namespace chrome.events {
|
|
3485
3478
|
hasListeners(): boolean;
|
3486
3479
|
}
|
3487
3480
|
|
3481
|
+
/** An object which allows the addition and removal of listeners for a Chrome event. */
|
3482
|
+
interface Event<T extends Function> extends BaseEvent<T> {
|
3483
|
+
/**
|
3484
|
+
* Registers an event listener callback to an event.
|
3485
|
+
* @param callback Called when an event occurs. The parameters of this function depend on the type of event.
|
3486
|
+
* The callback parameter should be a function that looks like this:
|
3487
|
+
* function() {...};
|
3488
|
+
*/
|
3489
|
+
addListener(callback: T): void;
|
3490
|
+
}
|
3491
|
+
export interface EventWithRequiredFilterInAddListener<T extends Function> extends BaseEvent<T> {
|
3492
|
+
addListener(callback: T, filter: webRequest.RequestFilter): void;
|
3493
|
+
}
|
3494
|
+
|
3488
3495
|
/** Description of a declarative rule for handling events. */
|
3489
3496
|
export interface Rule {
|
3490
3497
|
/** Optional. Optional priority of this rule. Defaults to 100. */
|
@@ -3541,7 +3548,7 @@ declare namespace chrome.extension {
|
|
3541
3548
|
* True for content scripts running inside incognito tabs, and for extension pages running inside an incognito process. The latter only applies to extensions with 'split' incognito_behavior.
|
3542
3549
|
*/
|
3543
3550
|
export var inIncognitoContext: boolean;
|
3544
|
-
/** Set for the lifetime of a callback if an ansychronous extension api has resulted in an error. If no error has
|
3551
|
+
/** Set for the lifetime of a callback if an ansychronous extension api has resulted in an error. If no error has occurred lastError will be undefined. */
|
3545
3552
|
export var lastError: LastError;
|
3546
3553
|
|
3547
3554
|
/** Returns the JavaScript 'window' object for the background page running inside the current extension. Returns null if the extension has no background page. */
|
@@ -7394,55 +7401,89 @@ declare namespace chrome.runtime {
|
|
7394
7401
|
/**
|
7395
7402
|
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
7396
7403
|
* @since Chrome 26.
|
7397
|
-
* @param responseCallback Optional
|
7398
7404
|
* Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
7399
7405
|
*/
|
7400
|
-
export function sendMessage<M = any, R = any>(message: M, responseCallback
|
7406
|
+
export function sendMessage<M = any, R = any>(message: M, responseCallback: (response: R) => void): void;
|
7401
7407
|
/**
|
7402
7408
|
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
7403
7409
|
* @since Chrome 32.
|
7404
|
-
* @param responseCallback Optional
|
7405
7410
|
* Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
7406
7411
|
*/
|
7407
7412
|
export function sendMessage<M = any, R = any>(
|
7408
7413
|
message: M,
|
7409
7414
|
options: MessageOptions,
|
7410
|
-
responseCallback
|
7415
|
+
responseCallback: (response: R) => void,
|
7411
7416
|
): void;
|
7412
7417
|
/**
|
7413
7418
|
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
7414
7419
|
* @since Chrome 26.
|
7415
7420
|
* @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
7416
|
-
* @param responseCallback Optional
|
7417
7421
|
* Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
7418
7422
|
*/
|
7419
|
-
export function sendMessage<M = any, R = any>(extensionId: string, message: M, responseCallback
|
7423
|
+
export function sendMessage<M = any, R = any>(extensionId: string, message: M, responseCallback: (response: R) => void): void;
|
7420
7424
|
/**
|
7421
7425
|
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
7422
7426
|
* @since Chrome 32.
|
7423
7427
|
* @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
7424
|
-
* @param responseCallback Optional
|
7425
7428
|
* Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
7426
7429
|
*/
|
7427
7430
|
export function sendMessage<Message = any, Response = any>(
|
7428
7431
|
extensionId: string,
|
7429
7432
|
message: Message,
|
7430
7433
|
options: MessageOptions,
|
7431
|
-
responseCallback
|
7434
|
+
responseCallback: (response: Response) => void,
|
7432
7435
|
): void;
|
7436
|
+
/**
|
7437
|
+
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
7438
|
+
* @since Chrome 26.
|
7439
|
+
*/
|
7440
|
+
export function sendMessage<M = any, R = any>(message: M): Promise<R>;
|
7441
|
+
/**
|
7442
|
+
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
7443
|
+
* @since Chrome 32.
|
7444
|
+
*/
|
7445
|
+
export function sendMessage<M = any, R = any>(
|
7446
|
+
message: M,
|
7447
|
+
options: MessageOptions,
|
7448
|
+
): Promise<R>;
|
7449
|
+
/**
|
7450
|
+
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
7451
|
+
* @since Chrome 26.
|
7452
|
+
* @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
7453
|
+
*/
|
7454
|
+
export function sendMessage<M = any, R = any>(extensionId: string, message: M): Promise<R>;
|
7455
|
+
/**
|
7456
|
+
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
7457
|
+
* @since Chrome 32.
|
7458
|
+
* @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
7459
|
+
*/
|
7460
|
+
export function sendMessage<Message = any, Response = any>(
|
7461
|
+
extensionId: string,
|
7462
|
+
message: Message,
|
7463
|
+
options: MessageOptions,
|
7464
|
+
): Promise<Response>;
|
7433
7465
|
/**
|
7434
7466
|
* Send a single message to a native application.
|
7435
7467
|
* @since Chrome 28.
|
7436
7468
|
* @param application The of the native messaging host.
|
7437
7469
|
* @param message The message that will be passed to the native messaging host.
|
7438
|
-
* @param responseCallback Optional.
|
7439
7470
|
* Parameter response: The response message sent by the native messaging host. If an error occurs while connecting to the native messaging host, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
7440
7471
|
*/
|
7441
7472
|
export function sendNativeMessage(
|
7442
7473
|
application: string,
|
7443
7474
|
message: Object,
|
7444
|
-
responseCallback
|
7475
|
+
responseCallback: (response: any) => void,
|
7445
7476
|
): void;
|
7477
|
+
/**
|
7478
|
+
* Send a single message to a native application.
|
7479
|
+
* @since Chrome 28.
|
7480
|
+
* @param application The of the native messaging host.
|
7481
|
+
* @param message The message that will be passed to the native messaging host.
|
7482
|
+
*/
|
7483
|
+
export function sendNativeMessage(
|
7484
|
+
application: string,
|
7485
|
+
message: Object,
|
7486
|
+
): Promise<any>;
|
7446
7487
|
/**
|
7447
7488
|
* Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum 255 characters.
|
7448
7489
|
* @since Chrome 41.
|
@@ -10797,41 +10838,42 @@ declare namespace chrome.webRequest {
|
|
10797
10838
|
}
|
10798
10839
|
|
10799
10840
|
export interface WebRequestBodyEvent
|
10800
|
-
extends chrome.events.
|
10841
|
+
extends chrome.events.EventWithRequiredFilterInAddListener<(details: WebRequestBodyDetails) => BlockingResponse | void> {
|
10801
10842
|
addListener(
|
10802
10843
|
callback: (details: WebRequestBodyDetails) => BlockingResponse | void,
|
10803
|
-
filter
|
10844
|
+
filter: RequestFilter,
|
10804
10845
|
opt_extraInfoSpec?: string[],
|
10805
10846
|
): void;
|
10806
10847
|
}
|
10807
10848
|
|
10808
10849
|
export interface WebRequestHeadersSynchronousEvent
|
10809
|
-
extends chrome.events.
|
10850
|
+
extends chrome.events.EventWithRequiredFilterInAddListener<(details: WebRequestHeadersDetails) => BlockingResponse | void> {
|
10810
10851
|
addListener(
|
10811
10852
|
callback: (details: WebRequestHeadersDetails) => BlockingResponse | void,
|
10812
|
-
filter
|
10853
|
+
filter: RequestFilter,
|
10813
10854
|
opt_extraInfoSpec?: string[],
|
10814
10855
|
): void;
|
10815
10856
|
}
|
10816
10857
|
|
10817
|
-
export interface WebRequestHeadersEvent
|
10858
|
+
export interface WebRequestHeadersEvent
|
10859
|
+
extends chrome.events.EventWithRequiredFilterInAddListener<(details: WebRequestHeadersDetails) => void> {
|
10818
10860
|
addListener(
|
10819
10861
|
callback: (details: WebRequestHeadersDetails) => void,
|
10820
|
-
filter
|
10862
|
+
filter: RequestFilter,
|
10821
10863
|
opt_extraInfoSpec?: string[],
|
10822
10864
|
): void;
|
10823
10865
|
}
|
10824
10866
|
|
10825
10867
|
export interface _WebResponseHeadersEvent<T extends WebResponseHeadersDetails>
|
10826
|
-
extends chrome.events.
|
10827
|
-
addListener(callback: (details: T) => void, filter
|
10868
|
+
extends chrome.events.EventWithRequiredFilterInAddListener<(details: T) => void> {
|
10869
|
+
addListener(callback: (details: T) => void, filter: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
10828
10870
|
}
|
10829
10871
|
|
10830
10872
|
export interface WebResponseHeadersEvent
|
10831
|
-
extends chrome.events.
|
10873
|
+
extends chrome.events.EventWithRequiredFilterInAddListener<(details: WebResponseHeadersDetails) => BlockingResponse | void> {
|
10832
10874
|
addListener(
|
10833
10875
|
callback: (details: WebResponseHeadersDetails) => BlockingResponse | void,
|
10834
|
-
filter
|
10876
|
+
filter: RequestFilter,
|
10835
10877
|
opt_extraInfoSpec?: string[],
|
10836
10878
|
): void;
|
10837
10879
|
}
|
@@ -10841,7 +10883,7 @@ declare namespace chrome.webRequest {
|
|
10841
10883
|
export interface WebRedirectionResponseEvent extends _WebResponseHeadersEvent<WebRedirectionResponseDetails> { }
|
10842
10884
|
|
10843
10885
|
export interface WebAuthenticationChallengeEvent
|
10844
|
-
extends chrome.events.
|
10886
|
+
extends chrome.events.EventWithRequiredFilterInAddListener<
|
10845
10887
|
(details: WebAuthenticationChallengeDetails, callback?: (response: BlockingResponse) => void) => void
|
10846
10888
|
> {
|
10847
10889
|
addListener(
|
@@ -10849,7 +10891,7 @@ declare namespace chrome.webRequest {
|
|
10849
10891
|
details: WebAuthenticationChallengeDetails,
|
10850
10892
|
callback?: (response: BlockingResponse) => void,
|
10851
10893
|
) => void,
|
10852
|
-
filter
|
10894
|
+
filter: RequestFilter,
|
10853
10895
|
opt_extraInfoSpec?: string[],
|
10854
10896
|
): void;
|
10855
10897
|
}
|
chrome/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/chrome",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.183",
|
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",
|
@@ -98,6 +98,6 @@
|
|
98
98
|
"@types/filesystem": "*",
|
99
99
|
"@types/har-format": "*"
|
100
100
|
},
|
101
|
-
"typesPublisherContentHash": "
|
101
|
+
"typesPublisherContentHash": "2f9c6b07ea8c49d6a58620305e16d1ff0ca1fa1490a4af140b3f676e856b8fef",
|
102
102
|
"typeScriptVersion": "3.9"
|
103
103
|
}
|