@types/chrome 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chrome/README.md +1 -1
- chrome/index.d.ts +178 -241
- chrome/package.json +2 -2
chrome/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (https://developer.chrome.com/
|
|
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, 12 Sep 2025 19:02:26 GMT
|
12
12
|
* Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
|
13
13
|
|
14
14
|
# Credits
|
chrome/index.d.ts
CHANGED
@@ -377,120 +377,76 @@ declare namespace chrome {
|
|
377
377
|
*/
|
378
378
|
export namespace alarms {
|
379
379
|
export interface AlarmCreateInfo {
|
380
|
-
/**
|
380
|
+
/** Length of time in minutes after which the {@link onAlarm} event should fire. */
|
381
381
|
delayInMinutes?: number | undefined;
|
382
|
-
/**
|
382
|
+
/** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
|
383
383
|
periodInMinutes?: number | undefined;
|
384
|
-
/**
|
384
|
+
/** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
|
385
385
|
when?: number | undefined;
|
386
386
|
}
|
387
387
|
|
388
388
|
export interface Alarm {
|
389
|
-
/**
|
390
|
-
periodInMinutes?: number
|
391
|
-
/** Time at which this alarm was scheduled to fire, in milliseconds past the epoch (e.g. Date.now() + n). For performance reasons, the alarm may have been delayed an arbitrary amount beyond this. */
|
389
|
+
/** If not null, the alarm is a repeating alarm and will fire again in `periodInMinutes` minutes. */
|
390
|
+
periodInMinutes?: number;
|
391
|
+
/** Time at which this alarm was scheduled to fire, in milliseconds past the epoch (e.g. `Date.now() + n`). For performance reasons, the alarm may have been delayed an arbitrary amount beyond this. */
|
392
392
|
scheduledTime: number;
|
393
393
|
/** Name of this alarm. */
|
394
394
|
name: string;
|
395
395
|
}
|
396
396
|
|
397
|
-
export interface AlarmEvent extends chrome.events.Event<(alarm: Alarm) => void> {}
|
398
|
-
|
399
|
-
/**
|
400
|
-
* Creates an alarm. Near the time(s) specified by alarmInfo, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.
|
401
|
-
* In order to reduce the load on the user's machine, Chrome limits alarms to at most once every 1 minute but may delay them an arbitrary amount more. That is, setting delayInMinutes or periodInMinutes to less than 1 will not be honored and will cause a warning. when can be set to less than 1 minute after "now" without warning but won't actually cause the alarm to fire for at least 1 minute.
|
402
|
-
* To help you debug your app or extension, when you've loaded it unpacked, there's no limit to how often the alarm can fire.
|
403
|
-
* @param alarmInfo Describes when the alarm should fire. The initial time must be specified by either when or delayInMinutes (but not both). If periodInMinutes is set, the alarm will repeat every periodInMinutes minutes after the initial event. If neither when or delayInMinutes is set for a repeating alarm, periodInMinutes is used as the default for delayInMinutes.
|
404
|
-
* @return The `create` method provides its result via callback or returned as a `Promise` (MV3 only).
|
405
|
-
*/
|
406
|
-
export function create(alarmInfo: AlarmCreateInfo): Promise<void>;
|
407
397
|
/**
|
408
|
-
* Creates an alarm. Near the time(s) specified by alarmInfo
|
409
|
-
*
|
398
|
+
* Creates an alarm. Near the time(s) specified by `alarmInfo`, the {@link onAlarm} event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.
|
399
|
+
*
|
400
|
+
* In order to reduce the load on the user's machine, Chrome limits alarms to at most once every 30 seconds but may delay them an arbitrary amount more. That is, setting `delayInMinutes` or `periodInMinutes` to less than `0.5` will not be honored and will cause a warning. `when` can be set to less than 30 seconds after "now" without warning but won't actually cause the alarm to fire for at least 30 seconds.
|
401
|
+
*
|
410
402
|
* To help you debug your app or extension, when you've loaded it unpacked, there's no limit to how often the alarm can fire.
|
411
403
|
* @param name Optional name to identify this alarm. Defaults to the empty string.
|
412
|
-
* @param alarmInfo Describes when the alarm should fire. The initial time must be specified by either when or delayInMinutes (but not both). If periodInMinutes is set, the alarm will repeat every periodInMinutes minutes after the initial event. If neither when or delayInMinutes is set for a repeating alarm, periodInMinutes is used as the default for delayInMinutes
|
413
|
-
*
|
414
|
-
|
415
|
-
export function create(name: string, alarmInfo: AlarmCreateInfo): Promise<void>;
|
416
|
-
/**
|
417
|
-
* Creates an alarm. Near the time(s) specified by alarmInfo, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.
|
418
|
-
* In order to reduce the load on the user's machine, Chrome limits alarms to at most once every 1 minute but may delay them an arbitrary amount more. That is, setting delayInMinutes or periodInMinutes to less than 1 will not be honored and will cause a warning. when can be set to less than 1 minute after "now" without warning but won't actually cause the alarm to fire for at least 1 minute.
|
419
|
-
* To help you debug your app or extension, when you've loaded it unpacked, there's no limit to how often the alarm can fire.
|
420
|
-
* @param alarmInfo Describes when the alarm should fire. The initial time must be specified by either when or delayInMinutes (but not both). If periodInMinutes is set, the alarm will repeat every periodInMinutes minutes after the initial event. If neither when or delayInMinutes is set for a repeating alarm, periodInMinutes is used as the default for delayInMinutes.
|
404
|
+
* @param alarmInfo Describes when the alarm should fire. The initial time must be specified by either `when` or `delayInMinutes` (but not both). If `periodInMinutes` is set, the alarm will repeat every `periodInMinutes` minutes after the initial event. If neither `when` or `delayInMinutes` is set for a repeating alarm, `periodInMinutes` is used as the default for `delayInMinutes`.
|
405
|
+
*
|
406
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 111.
|
421
407
|
*/
|
408
|
+
export function create(alarmInfo: AlarmCreateInfo): Promise<void>;
|
409
|
+
export function create(name: string | undefined, alarmInfo: AlarmCreateInfo): Promise<void>;
|
422
410
|
export function create(alarmInfo: AlarmCreateInfo, callback: () => void): void;
|
423
|
-
|
424
|
-
|
425
|
-
* In order to reduce the load on the user's machine, Chrome limits alarms to at most once every 1 minute but may delay them an arbitrary amount more. That is, setting delayInMinutes or periodInMinutes to less than 1 will not be honored and will cause a warning. when can be set to less than 1 minute after "now" without warning but won't actually cause the alarm to fire for at least 1 minute.
|
426
|
-
* To help you debug your app or extension, when you've loaded it unpacked, there's no limit to how often the alarm can fire.
|
427
|
-
* @param name Optional name to identify this alarm. Defaults to the empty string.
|
428
|
-
* @param alarmInfo Describes when the alarm should fire. The initial time must be specified by either when or delayInMinutes (but not both). If periodInMinutes is set, the alarm will repeat every periodInMinutes minutes after the initial event. If neither when or delayInMinutes is set for a repeating alarm, periodInMinutes is used as the default for delayInMinutes.
|
429
|
-
*/
|
430
|
-
export function create(name: string, alarmInfo: AlarmCreateInfo, callback: () => void): void;
|
431
|
-
/**
|
432
|
-
* Gets an array of all the alarms.
|
433
|
-
*/
|
434
|
-
export function getAll(callback: (alarms: Alarm[]) => void): void;
|
411
|
+
export function create(name: string | undefined, alarmInfo: AlarmCreateInfo, callback: () => void): void;
|
412
|
+
|
435
413
|
/**
|
436
414
|
* Gets an array of all the alarms.
|
437
|
-
*
|
415
|
+
*
|
416
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 91.
|
438
417
|
*/
|
439
418
|
export function getAll(): Promise<Alarm[]>;
|
419
|
+
export function getAll(callback: (alarms: Alarm[]) => void): void;
|
420
|
+
|
440
421
|
/**
|
441
422
|
* Clears all alarms.
|
442
|
-
*
|
443
|
-
*
|
423
|
+
*
|
424
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 91.
|
444
425
|
*/
|
445
426
|
export function clearAll(): Promise<boolean>;
|
446
|
-
/**
|
447
|
-
* Clears all alarms.
|
448
|
-
*/
|
449
427
|
export function clearAll(callback: (wasCleared: boolean) => void): void;
|
428
|
+
|
450
429
|
/**
|
451
430
|
* Clears the alarm with the given name.
|
452
|
-
*
|
453
|
-
*
|
431
|
+
*
|
432
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 91.
|
454
433
|
*/
|
455
434
|
export function clear(name?: string): Promise<boolean>;
|
456
|
-
/**
|
457
|
-
* Clears the alarm with the given name.
|
458
|
-
* @param name The name of the alarm to clear. Defaults to the empty string.
|
459
|
-
*/
|
460
435
|
export function clear(callback: (wasCleared: boolean) => void): void;
|
461
|
-
export function clear(name: string, callback: (wasCleared: boolean) => void): void;
|
462
|
-
|
463
|
-
* Clears the alarm without a name.
|
464
|
-
*/
|
465
|
-
export function clear(callback: (wasCleared: boolean) => void): void;
|
466
|
-
/**
|
467
|
-
* Clears the alarm without a name.
|
468
|
-
* @return The `clear` method provides its result via callback or returned as a `Promise` (MV3 only).
|
469
|
-
*/
|
470
|
-
export function clear(): Promise<void>;
|
471
|
-
/**
|
472
|
-
* Retrieves details about the specified alarm.
|
473
|
-
*/
|
474
|
-
export function get(callback: (alarm?: Alarm) => void): void;
|
475
|
-
/**
|
476
|
-
* Retrieves details about the specified alarm.
|
477
|
-
* @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
|
478
|
-
*/
|
479
|
-
export function get(): Promise<Alarm | undefined>;
|
480
|
-
/**
|
481
|
-
* Retrieves details about the specified alarm.
|
482
|
-
* @param name The name of the alarm to get. Defaults to the empty string.
|
483
|
-
*/
|
484
|
-
export function get(name: string, callback: (alarm?: Alarm) => void): void;
|
436
|
+
export function clear(name: string | undefined, callback: (wasCleared: boolean) => void): void;
|
437
|
+
|
485
438
|
/**
|
486
439
|
* Retrieves details about the specified alarm.
|
487
440
|
* @param name The name of the alarm to get. Defaults to the empty string.
|
488
|
-
*
|
441
|
+
*
|
442
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 91.
|
489
443
|
*/
|
490
|
-
export function get(name
|
444
|
+
export function get(name?: string): Promise<Alarm | undefined>;
|
445
|
+
export function get(callback: (alarm?: Alarm) => void): void;
|
446
|
+
export function get(name: string | undefined, callback: (alarm?: Alarm) => void): void;
|
491
447
|
|
492
448
|
/** Fired when an alarm has elapsed. Useful for event pages. */
|
493
|
-
export
|
449
|
+
export const onAlarm: events.Event<(alarm: Alarm) => void>;
|
494
450
|
}
|
495
451
|
|
496
452
|
////////////////////
|
@@ -2450,45 +2406,70 @@ declare namespace chrome {
|
|
2450
2406
|
* Permissions: "declarativeContent"
|
2451
2407
|
*/
|
2452
2408
|
export namespace declarativeContent {
|
2453
|
-
|
2454
|
-
/**
|
2409
|
+
interface PageStateMatcherProperties {
|
2410
|
+
/** Matches if the conditions of the `UrlFilter` are fulfilled for the top-level URL of the page. */
|
2455
2411
|
pageUrl?: events.UrlFilter | undefined;
|
2456
|
-
/**
|
2412
|
+
/** Matches if all of the CSS selectors in the array match displayed elements in a frame with the same origin as the page's main frame. All selectors in this array must be compound selectors to speed up matching. Note: Listing hundreds of CSS selectors or listing CSS selectors that match hundreds of times per page can slow down web sites. */
|
2457
2413
|
css?: string[] | undefined;
|
2458
2414
|
/**
|
2459
|
-
* Optional.
|
2460
|
-
* @since Chrome 45
|
2461
2415
|
* Matches if the bookmarked state of the page is equal to the specified value. Requires the bookmarks permission.
|
2416
|
+
* @since Chrome 45
|
2462
2417
|
*/
|
2463
2418
|
isBookmarked?: boolean | undefined;
|
2464
2419
|
}
|
2465
2420
|
|
2466
|
-
/** Matches the state of a web page
|
2421
|
+
/** Matches the state of a web page based on various criteria. */
|
2467
2422
|
export class PageStateMatcher {
|
2468
|
-
constructor(
|
2423
|
+
constructor(arg: PageStateMatcherProperties);
|
2424
|
+
}
|
2425
|
+
|
2426
|
+
export interface RequestContentScriptProperties {
|
2427
|
+
/** Whether the content script runs in all frames of the matching page, or in only the top frame. Default is `false`. */
|
2428
|
+
allFrames?: boolean | undefined;
|
2429
|
+
|
2430
|
+
/** Names of CSS files to be injected as a part of the content script. */
|
2431
|
+
css?: string[] | undefined;
|
2432
|
+
|
2433
|
+
/** Names of JavaScript files to be injected as a part of the content script. */
|
2434
|
+
js?: string[] | undefined;
|
2435
|
+
|
2436
|
+
/** Whether to insert the content script on `about:blank` and `about:srcdoc`. Default is `false`. */
|
2437
|
+
matchAboutBlank?: boolean | undefined;
|
2438
|
+
}
|
2439
|
+
|
2440
|
+
/** Declarative event action that injects a content script. */
|
2441
|
+
export class RequestContentScript {
|
2442
|
+
constructor(arg: RequestContentScriptProperties);
|
2469
2443
|
}
|
2470
2444
|
|
2471
2445
|
/**
|
2472
|
-
*
|
2473
|
-
*
|
2446
|
+
* A declarative event action that sets the extension's toolbar {@link action} to an enabled state while the corresponding conditions are met. This action can be used without host permissions. If the extension has the `activeTab` permission, clicking the page action grants access to the active tab.
|
2447
|
+
*
|
2448
|
+
* On pages where the conditions are not met the extension's toolbar action will be grey-scale, and clicking it will open the context menu, instead of triggering the action.
|
2449
|
+
* @since MV3
|
2474
2450
|
*/
|
2475
2451
|
export class ShowAction {}
|
2476
2452
|
|
2477
2453
|
/**
|
2478
|
-
*
|
2479
|
-
*
|
2454
|
+
* A declarative event action that sets the extension's {@link pageAction} to an enabled state while the corresponding conditions are met. This action can be used without host permissions, but the extension must have a page action. If the extension has the `activeTab` permission, clicking the page action grants access to the active tab.
|
2455
|
+
*
|
2456
|
+
* On pages where the conditions are not met the extension's toolbar action will be grey-scale, and clicking it will open the context menu, instead of triggering the action.
|
2457
|
+
*
|
2458
|
+
* MV2 only
|
2480
2459
|
*/
|
2481
2460
|
export class ShowPageAction {}
|
2482
2461
|
|
2483
|
-
/**
|
2462
|
+
/**
|
2463
|
+
* Declarative event action that sets the n-dip square icon for the extension's {@link pageAction} or {@link browserAction} while the corresponding conditions are met. This action can be used without host permissions, but the extension must have a page or browser action.
|
2464
|
+
*
|
2465
|
+
* Exactly one of `imageData` or `path` must be specified. Both are dictionaries mapping a number of pixels to an image representation. The image representation in `imageData` is an `ImageData` object; for example, from a `canvas` element, while the image representation in `path` is the path to an image file relative to the extension's manifest. If `scale` screen pixels fit into a device-independent pixel, the `scale * n` icon is used. If that scale is missing, another image is resized to the required size.
|
2466
|
+
*/
|
2484
2467
|
export class SetIcon {
|
2485
2468
|
constructor(options?: { imageData?: ImageData | { [size: string]: ImageData } | undefined });
|
2486
2469
|
}
|
2487
2470
|
|
2488
|
-
/** Provides the Declarative Event API consisting of addRules, removeRules, and getRules. */
|
2489
|
-
export
|
2490
|
-
|
2491
|
-
export var onPageChanged: PageChangedEvent;
|
2471
|
+
/** Provides the Declarative Event API consisting of {@link events.Event.addRules addRules}, {@link events.Event.removeRules removeRules}, and {@link events.Event.getRules getRules}. */
|
2472
|
+
export const onPageChanged: events.Event<() => void>;
|
2492
2473
|
}
|
2493
2474
|
|
2494
2475
|
////////////////////
|
@@ -2772,41 +2753,32 @@ declare namespace chrome {
|
|
2772
2753
|
* Manifest: "devtools_page"
|
2773
2754
|
*/
|
2774
2755
|
export namespace devtools.network {
|
2775
|
-
/** Represents a HAR entry for a specific finished request. */
|
2776
|
-
export interface HAREntry extends HARFormatEntry {}
|
2777
|
-
/** Represents a HAR log that contains all known network requests. */
|
2778
|
-
export interface HARLog extends HARFormatLog {}
|
2779
2756
|
/** Represents a network request for a document resource (script, image and so on). See HAR Specification for reference. */
|
2780
|
-
export interface Request extends
|
2781
|
-
/**
|
2782
|
-
* Returns content of the response body.
|
2783
|
-
* @param callback A function that receives the response body when the request completes.
|
2784
|
-
*/
|
2757
|
+
export interface Request extends HARFormatEntry {
|
2758
|
+
/** Returns content of the response body. */
|
2785
2759
|
getContent(
|
2786
2760
|
callback: (
|
2787
|
-
/** Content of the response body (potentially encoded) */
|
2761
|
+
/** Content of the response body (potentially encoded). */
|
2788
2762
|
content: string,
|
2789
|
-
/** Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported */
|
2763
|
+
/** Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported. */
|
2790
2764
|
encoding: string,
|
2791
2765
|
) => void,
|
2792
2766
|
): void;
|
2793
2767
|
}
|
2794
2768
|
|
2795
|
-
|
2796
|
-
|
2797
|
-
|
2798
|
-
|
2799
|
-
|
2800
|
-
|
2801
|
-
|
2802
|
-
* Parameter harLog: A HAR log. See HAR specification for details.
|
2803
|
-
*/
|
2804
|
-
export function getHAR(callback: (harLog: HARLog) => void): void;
|
2769
|
+
/** Returns HAR log that contains all known network requests. */
|
2770
|
+
export function getHAR(
|
2771
|
+
callback: (
|
2772
|
+
/** A HAR log. See HAR specification for details. */
|
2773
|
+
harLog: HARFormatLog,
|
2774
|
+
) => void,
|
2775
|
+
): void;
|
2805
2776
|
|
2806
2777
|
/** Fired when a network request is finished and all request data are available. */
|
2807
|
-
export
|
2778
|
+
export const onRequestFinished: events.Event<(request: Request) => void>;
|
2779
|
+
|
2808
2780
|
/** Fired when the inspected window navigates to a new page. */
|
2809
|
-
export
|
2781
|
+
export const onNavigated: events.Event<(url: string) => void>;
|
2810
2782
|
}
|
2811
2783
|
|
2812
2784
|
////////////////////
|
@@ -4340,7 +4312,8 @@ declare namespace chrome {
|
|
4340
4312
|
* Unregisters currently registered rules.
|
4341
4313
|
* @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are unregistered.
|
4342
4314
|
*/
|
4343
|
-
removeRules(ruleIdentifiers
|
4315
|
+
removeRules(ruleIdentifiers: string[] | undefined, callback?: () => void): void;
|
4316
|
+
removeRules(callback?: () => void): void;
|
4344
4317
|
|
4345
4318
|
/**
|
4346
4319
|
* Registers rules to handle events.
|
@@ -4385,117 +4358,114 @@ declare namespace chrome {
|
|
4385
4358
|
* The `chrome.extension` API has utilities that can be used by any extension page. It includes support for exchanging messages between an extension and its content scripts or between extensions, as described in detail in Message Passing.
|
4386
4359
|
*/
|
4387
4360
|
export namespace extension {
|
4361
|
+
/**
|
4362
|
+
* The type of extension view.
|
4363
|
+
* @since Chrome 44
|
4364
|
+
*/
|
4365
|
+
export enum ViewType {
|
4366
|
+
TAB = "tab",
|
4367
|
+
POPUP = "popup",
|
4368
|
+
}
|
4369
|
+
|
4388
4370
|
export interface FetchProperties {
|
4389
4371
|
/**
|
4390
|
-
* Optional.
|
4391
|
-
* Chrome 54+
|
4392
4372
|
* Find a view according to a tab id. If this field is omitted, returns all views.
|
4373
|
+
* @since Chrome 54
|
4393
4374
|
*/
|
4394
4375
|
tabId?: number | undefined;
|
4395
|
-
/**
|
4376
|
+
/** The window to restrict the search to. If omitted, returns all views. */
|
4396
4377
|
windowId?: number | undefined;
|
4397
|
-
/**
|
4398
|
-
type?:
|
4378
|
+
/** The type of view to get. If omitted, returns all views (including background pages and tabs). */
|
4379
|
+
type?: `${ViewType}` | undefined;
|
4399
4380
|
}
|
4400
4381
|
|
4401
|
-
|
4402
|
-
|
4403
|
-
message: string;
|
4404
|
-
}
|
4405
|
-
|
4406
|
-
export interface OnRequestEvent extends
|
4407
|
-
chrome.events.Event<
|
4408
|
-
| ((request: any, sender: runtime.MessageSender, sendResponse: (response: any) => void) => void)
|
4409
|
-
| ((sender: runtime.MessageSender, sendResponse: (response: any) => void) => void)
|
4410
|
-
>
|
4411
|
-
{}
|
4382
|
+
/** 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. */
|
4383
|
+
export const inIncognitoContext: boolean;
|
4412
4384
|
|
4413
4385
|
/**
|
4414
|
-
*
|
4415
|
-
*
|
4386
|
+
* 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`.
|
4387
|
+
* @deprecated since Chrome 58. Please use {@link runtime.lastError}
|
4416
4388
|
*/
|
4417
|
-
export
|
4418
|
-
/** 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. */
|
4419
|
-
export var lastError: LastError;
|
4389
|
+
export const lastError: runtime.LastError | undefined;
|
4420
4390
|
|
4421
4391
|
/** Returns the JavaScript 'window' object for the background page running inside the current extension. Returns null if the extension has no background page. */
|
4422
4392
|
export function getBackgroundPage(): Window | null;
|
4393
|
+
|
4423
4394
|
/**
|
4424
4395
|
* Converts a relative path within an extension install directory to a fully-qualified URL.
|
4425
4396
|
* @param path A path to a resource within an extension expressed relative to its install directory.
|
4397
|
+
* @deprecated since Chrome 58. Please use {@link runtime.getURL}
|
4426
4398
|
*/
|
4427
4399
|
export function getURL(path: string): string;
|
4428
|
-
|
4429
|
-
|
4430
|
-
* @since Chrome 9
|
4431
|
-
*/
|
4400
|
+
|
4401
|
+
/** Sets the value of the ap CGI parameter used in the extension's update URL. This value is ignored for extensions that are hosted in the Chrome Extension Gallery. */
|
4432
4402
|
export function setUpdateUrlData(data: string): void;
|
4403
|
+
|
4433
4404
|
/** Returns an array of the JavaScript 'window' objects for each of the pages running inside the current extension. */
|
4434
4405
|
export function getViews(fetchProperties?: FetchProperties): Window[];
|
4406
|
+
|
4435
4407
|
/**
|
4436
|
-
* Retrieves the state of the extension's access to the 'file://' scheme
|
4437
|
-
*
|
4438
|
-
*
|
4408
|
+
* Retrieves the state of the extension's access to the 'file://' scheme. This corresponds to the user-controlled per-extension 'Allow access to File URLs' setting accessible via the `chrome://extensions` page.
|
4409
|
+
*
|
4410
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
4439
4411
|
*/
|
4440
4412
|
export function isAllowedFileSchemeAccess(): Promise<boolean>;
|
4441
|
-
/**
|
4442
|
-
* Retrieves the state of the extension's access to the 'file://' scheme (as determined by the user-controlled 'Allow access to File URLs' checkbox.
|
4443
|
-
* @since Chrome 12
|
4444
|
-
* Parameter isAllowedAccess: True if the extension can access the 'file://' scheme, false otherwise.
|
4445
|
-
*/
|
4446
4413
|
export function isAllowedFileSchemeAccess(callback: (isAllowedAccess: boolean) => void): void;
|
4414
|
+
|
4447
4415
|
/**
|
4448
|
-
* Retrieves the state of the extension's access to Incognito-mode
|
4449
|
-
*
|
4450
|
-
*
|
4416
|
+
* Retrieves the state of the extension's access to Incognito-mode. This corresponds to the user-controlled per-extension 'Allowed in Incognito' setting accessible via the `chrome://extensions` page.
|
4417
|
+
*
|
4418
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
4451
4419
|
*/
|
4452
4420
|
export function isAllowedIncognitoAccess(): Promise<boolean>;
|
4453
|
-
/**
|
4454
|
-
* Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in Incognito' checkbox.
|
4455
|
-
* @since Chrome 12
|
4456
|
-
* Parameter isAllowedAccess: True if the extension has access to Incognito mode, false otherwise.
|
4457
|
-
*/
|
4458
4421
|
export function isAllowedIncognitoAccess(callback: (isAllowedAccess: boolean) => void): void;
|
4422
|
+
|
4459
4423
|
/**
|
4460
|
-
* Sends a single request to other listeners within the extension. Similar to runtime.connect, but only sends a single request with an optional response. The extension.onRequest event is fired in each page of the extension.
|
4461
|
-
*
|
4424
|
+
* Sends a single request to other listeners within the extension. Similar to {@link runtime.connect}, but only sends a single request with an optional response. The {@link extension.onRequest} event is fired in each page of the extension.
|
4425
|
+
*
|
4426
|
+
* MV2 only
|
4462
4427
|
* @param extensionId The extension ID of the extension you want to connect to. If omitted, default is your own extension.
|
4463
|
-
* @
|
4464
|
-
* function(any response) {...};
|
4465
|
-
* Parameter response: The JSON response object sent by the handler of the request. 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.
|
4428
|
+
* @deprecated Please use {@link runtime.sendMessage}
|
4466
4429
|
*/
|
4467
4430
|
export function sendRequest<Request = any, Response = any>(
|
4468
|
-
extensionId: string,
|
4431
|
+
extensionId: string | undefined,
|
4469
4432
|
request: Request,
|
4470
|
-
|
4433
|
+
callback?: (response: Response) => void,
|
4471
4434
|
): void;
|
4472
|
-
/**
|
4473
|
-
* Sends a single request to other listeners within the extension. Similar to runtime.connect, but only sends a single request with an optional response. The extension.onRequest event is fired in each page of the extension.
|
4474
|
-
* @deprecated Deprecated since Chrome 33. Please use runtime.sendMessage.
|
4475
|
-
* @param responseCallback If you specify the responseCallback parameter, it should be a function that looks like this:
|
4476
|
-
* function(any response) {...};
|
4477
|
-
* Parameter response: The JSON response object sent by the handler of the request. 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.
|
4478
|
-
*/
|
4479
4435
|
export function sendRequest<Request = any, Response = any>(
|
4480
4436
|
request: Request,
|
4481
|
-
|
4437
|
+
callback?: (response: Response) => void,
|
4482
4438
|
): void;
|
4439
|
+
|
4483
4440
|
/**
|
4484
|
-
* Returns an array of the JavaScript 'window' objects for each of the tabs running inside the current extension. If windowId is specified, returns only the 'window' objects of tabs attached to the specified window.
|
4485
|
-
*
|
4441
|
+
* Returns an array of the JavaScript 'window' objects for each of the tabs running inside the current extension. If `windowId` is specified, returns only the 'window' objects of tabs attached to the specified window.
|
4442
|
+
*
|
4443
|
+
* MV2 only
|
4444
|
+
* @deprecated Please use {@link extension.getViews} `{type: "tab"}`.
|
4486
4445
|
*/
|
4487
4446
|
export function getExtensionTabs(windowId?: number): Window[];
|
4488
4447
|
|
4489
4448
|
/**
|
4490
4449
|
* Fired when a request is sent from either an extension process or a content script.
|
4491
|
-
*
|
4450
|
+
*
|
4451
|
+
* MV2 only
|
4452
|
+
* @deprecated Please use {@link runtime.onMessage}.
|
4492
4453
|
*/
|
4493
|
-
export
|
4454
|
+
export const onRequest: chrome.events.Event<
|
4455
|
+
| ((request: any, sender: runtime.MessageSender, sendResponse: (response: any) => void) => void)
|
4456
|
+
| ((sender: runtime.MessageSender, sendResponse: (response: any) => void) => void)
|
4457
|
+
>;
|
4458
|
+
|
4494
4459
|
/**
|
4495
4460
|
* Fired when a request is sent from another extension.
|
4496
|
-
*
|
4461
|
+
*
|
4462
|
+
* MV2 only
|
4463
|
+
* @deprecated Please use {@link runtime.onMessageExternal}.
|
4497
4464
|
*/
|
4498
|
-
export
|
4465
|
+
export const onRequestExternal: chrome.events.Event<
|
4466
|
+
| ((request: any, sender: runtime.MessageSender, sendResponse: (response: any) => void) => void)
|
4467
|
+
| ((sender: runtime.MessageSender, sendResponse: (response: any) => void) => void)
|
4468
|
+
>;
|
4499
4469
|
}
|
4500
4470
|
|
4501
4471
|
////////////////////
|
@@ -4586,47 +4556,16 @@ declare namespace chrome {
|
|
4586
4556
|
* @platform ChromeOS only
|
4587
4557
|
*/
|
4588
4558
|
export namespace fileBrowserHandler {
|
4589
|
-
export interface SelectionParams {
|
4590
|
-
/**
|
4591
|
-
* Optional.
|
4592
|
-
* List of file extensions that the selected file can have. The list is also used to specify what files to be shown in the select file dialog. Files with the listed extensions are only shown in the dialog. Extensions should not include the leading '.'. Example: ['jpg', 'png']
|
4593
|
-
* @since Chrome 23
|
4594
|
-
*/
|
4595
|
-
allowedFileExtensions?: string[] | undefined;
|
4596
|
-
/** Suggested name for the file. */
|
4597
|
-
suggestedName: string;
|
4598
|
-
}
|
4599
|
-
|
4600
|
-
export interface SelectionResult {
|
4601
|
-
/** Optional. Selected file entry. It will be null if a file hasn't been selected. */
|
4602
|
-
entry?: object | null | undefined;
|
4603
|
-
/** Whether the file has been selected. */
|
4604
|
-
success: boolean;
|
4605
|
-
}
|
4606
|
-
|
4607
4559
|
/** Event details payload for fileBrowserHandler.onExecute event. */
|
4608
4560
|
export interface FileHandlerExecuteEventDetails {
|
4609
|
-
/**
|
4610
|
-
tab_id?: number
|
4561
|
+
/** The ID of the tab that raised this event. Tab IDs are unique within a browser session. */
|
4562
|
+
tab_id?: number;
|
4611
4563
|
/** Array of Entry instances representing files that are targets of this action (selected in ChromeOS file browser). */
|
4612
4564
|
entries: any[];
|
4613
4565
|
}
|
4614
4566
|
|
4615
|
-
export interface FileBrowserHandlerExecuteEvent
|
4616
|
-
extends chrome.events.Event<(id: string, details: FileHandlerExecuteEventDetails) => void>
|
4617
|
-
{}
|
4618
|
-
|
4619
|
-
/**
|
4620
|
-
* Prompts user to select file path under which file should be saved. When the file is selected, file access permission required to use the file (read, write and create) are granted to the caller. The file will not actually get created during the function call, so function caller must ensure its existence before using it. The function has to be invoked with a user gesture.
|
4621
|
-
* @since Chrome 21
|
4622
|
-
* @param selectionParams Parameters that will be used while selecting the file.
|
4623
|
-
* @param callback Function called upon completion.
|
4624
|
-
* Parameter result: Result of the method.
|
4625
|
-
*/
|
4626
|
-
export function selectFile(selectionParams: SelectionParams, callback: (result: SelectionResult) => void): void;
|
4627
|
-
|
4628
4567
|
/** Fired when file system action is executed from ChromeOS file browser. */
|
4629
|
-
export
|
4568
|
+
export const onExecute: events.Event<(id: string, details: FileHandlerExecuteEventDetails) => void>;
|
4630
4569
|
}
|
4631
4570
|
|
4632
4571
|
////////////////////
|
@@ -5837,58 +5776,56 @@ declare namespace chrome {
|
|
5837
5776
|
* Manifest: "default_locale"
|
5838
5777
|
*/
|
5839
5778
|
export namespace i18n {
|
5840
|
-
/** Holds detected ISO language code and its percentage in the input string */
|
5841
5779
|
export interface DetectedLanguage {
|
5842
|
-
/** An ISO language code such as 'en' or 'fr'.
|
5843
|
-
* For a complete list of languages supported by this method, see [kLanguageInfoTable]{@link https://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc}.
|
5844
|
-
* For an unknown language, 'und' will be returned, which means that [percentage] of the text is unknown to CLD */
|
5845
5780
|
language: string;
|
5846
|
-
|
5847
5781
|
/** The percentage of the detected language */
|
5848
5782
|
percentage: number;
|
5849
5783
|
}
|
5850
5784
|
|
5851
|
-
/** Holds detected language reliability and array of DetectedLanguage */
|
5785
|
+
/** Holds detected language reliability and array of {@link DetectedLanguage} */
|
5852
5786
|
export interface LanguageDetectionResult {
|
5853
5787
|
/** CLD detected language reliability */
|
5854
5788
|
isReliable: boolean;
|
5855
|
-
|
5856
5789
|
/** Array of detectedLanguage */
|
5857
5790
|
languages: DetectedLanguage[];
|
5858
5791
|
}
|
5859
5792
|
|
5793
|
+
/** @since Chrome 79 */
|
5794
|
+
export interface GetMessageOptions {
|
5795
|
+
/** Escape `<` in translation to `<`. This applies only to the message itself, not to the placeholders. Developers might want to use this if the translation is used in an HTML context. Closure Templates used with Closure Compiler generate this automatically. */
|
5796
|
+
escapeLt?: boolean | undefined;
|
5797
|
+
}
|
5798
|
+
|
5860
5799
|
/**
|
5861
|
-
* Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use i18n.getUILanguage.
|
5862
|
-
*
|
5863
|
-
*
|
5800
|
+
* Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use {@link i18n.getUILanguage}.
|
5801
|
+
*
|
5802
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
5864
5803
|
*/
|
5865
5804
|
export function getAcceptLanguages(): Promise<string[]>;
|
5866
|
-
/**
|
5867
|
-
* Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use i18n.getUILanguage.
|
5868
|
-
* Parameter languages: Array of the accept languages of the browser, such as en-US,en,zh-CN
|
5869
|
-
*/
|
5870
5805
|
export function getAcceptLanguages(callback: (languages: string[]) => void): void;
|
5806
|
+
|
5871
5807
|
/**
|
5872
|
-
* Gets the localized string for the specified message. If the message is missing, this method returns an empty string (''). If the format of the getMessage() call is wrong — for example, messageName is not a string or the substitutions array has more than 9 elements — this method returns undefined
|
5873
|
-
* @param messageName The name of the message, as specified in the messages.json file.
|
5874
|
-
* @param substitutions
|
5875
|
-
*/
|
5876
|
-
export function getMessage(messageName: string, substitutions?: string | string[]): string;
|
5877
|
-
/**
|
5878
|
-
* Gets the browser UI language of the browser. This is different from i18n.getAcceptLanguages which returns the preferred user languages.
|
5879
|
-
* @since Chrome 35
|
5808
|
+
* Gets the localized string for the specified message. If the message is missing, this method returns an empty string (''). If the format of the `getMessage()` call is wrong — for example, messageName is not a string or the substitutions array has more than 9 elements — this method returns `undefined`.
|
5809
|
+
* @param messageName The name of the message, as specified in the `messages.json` file.
|
5810
|
+
* @param substitutions Up to 9 substitution strings, if the message requires any.
|
5880
5811
|
*/
|
5812
|
+
export function getMessage(messageName: string, substitutions?: string | Array<string | number>): string;
|
5813
|
+
export function getMessage(
|
5814
|
+
messageName: string,
|
5815
|
+
substitutions: string | Array<string | number> | undefined,
|
5816
|
+
options?: GetMessageOptions,
|
5817
|
+
): string;
|
5818
|
+
|
5819
|
+
/** Gets the browser UI language of the browser. This is different from {@link i18n.getAcceptLanguages} which returns the preferred user languages. */
|
5881
5820
|
export function getUILanguage(): string;
|
5882
5821
|
|
5883
5822
|
/** Detects the language of the provided text using CLD.
|
5884
5823
|
* @param text User input string to be translated.
|
5885
|
-
*
|
5886
|
-
*
|
5824
|
+
*
|
5825
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
5826
|
+
* @since Chrome 47
|
5887
5827
|
*/
|
5888
5828
|
export function detectLanguage(text: string): Promise<LanguageDetectionResult>;
|
5889
|
-
/** Detects the language of the provided text using CLD.
|
5890
|
-
* @param text User input string to be translated.
|
5891
|
-
*/
|
5892
5829
|
export function detectLanguage(text: string, callback: (result: LanguageDetectionResult) => void): void;
|
5893
5830
|
}
|
5894
5831
|
|
chrome/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/chrome",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.10",
|
4
4
|
"description": "TypeScript definitions for chrome",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
|
6
6
|
"license": "MIT",
|
@@ -94,6 +94,6 @@
|
|
94
94
|
"@types/har-format": "*"
|
95
95
|
},
|
96
96
|
"peerDependencies": {},
|
97
|
-
"typesPublisherContentHash": "
|
97
|
+
"typesPublisherContentHash": "a46e6689297c50bba1d7cc23508d14acdbf293bafc846406f96238879a6c46de",
|
98
98
|
"typeScriptVersion": "5.2"
|
99
99
|
}
|