@types/chrome 0.1.9 → 0.1.11

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.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +463 -347
  3. 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: Mon, 08 Sep 2025 17:34:26 GMT
11
+ * Last updated: Fri, 12 Sep 2025 19:32:39 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
- /** Optional. Length of time in minutes after which the onAlarm event should fire. */
380
+ /** Length of time in minutes after which the {@link onAlarm} event should fire. */
381
381
  delayInMinutes?: number | undefined;
382
- /** Optional. 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. */
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
- /** Optional. Time at which the alarm should fire, in milliseconds past the epoch (e.g. Date.now() + n). */
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
- /** Optional. If not null, the alarm is a repeating alarm and will fire again in periodInMinutes minutes. */
390
- periodInMinutes?: number | undefined;
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
397
  /**
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
- /**
408
- * 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.
409
- * 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.
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
- * @return The `create` method provides its result via callback or returned as a `Promise` (MV3 only).
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
- * 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.
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
- * @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
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
- * function(boolean wasCleared) {...};
443
- * @return The `clearAll` method provides its result via callback or returned as a `Promise` (MV3 only).
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
- * @param name The name of the alarm to clear. Defaults to the empty string.
453
- * @return The `clear` method provides its result via callback or returned as a `Promise` (MV3 only).
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
- * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
441
+ *
442
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
489
443
  */
490
- export function get(name: string): Promise<Alarm | undefined>;
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 var onAlarm: AlarmEvent;
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
- export class PageStateMatcherProperties {
2454
- /** Optional. Filters URLs for various criteria. See event filtering. All criteria are case sensitive. */
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
- /** Optional. 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 that listing hundreds of CSS selectors or CSS selectors that match hundreds of times per page can still slow down web sites. */
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 by various criteria. */
2421
+ /** Matches the state of a web page based on various criteria. */
2467
2422
  export class PageStateMatcher {
2468
- constructor(options: PageStateMatcherProperties);
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
- * Declarative event action that enables the extension's action while the corresponding conditions are met.
2473
- * Manifest v3.
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
- * Declarative event action that shows the extension's page action while the corresponding conditions are met.
2479
- * Manifest v2.
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
- /** Declarative event action that changes the icon of the page action while the corresponding conditions are met. */
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 interface PageChangedEvent extends chrome.events.Event<() => void> {}
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
  ////////////////////
@@ -4331,7 +4312,8 @@ declare namespace chrome {
4331
4312
  * Unregisters currently registered rules.
4332
4313
  * @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are unregistered.
4333
4314
  */
4334
- removeRules(ruleIdentifiers?: string[] | undefined, callback?: () => void): void;
4315
+ removeRules(ruleIdentifiers: string[] | undefined, callback?: () => void): void;
4316
+ removeRules(callback?: () => void): void;
4335
4317
 
4336
4318
  /**
4337
4319
  * Registers rules to handle events.
@@ -4376,117 +4358,114 @@ declare namespace chrome {
4376
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.
4377
4359
  */
4378
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
+
4379
4370
  export interface FetchProperties {
4380
4371
  /**
4381
- * Optional.
4382
- * Chrome 54+
4383
4372
  * Find a view according to a tab id. If this field is omitted, returns all views.
4373
+ * @since Chrome 54
4384
4374
  */
4385
4375
  tabId?: number | undefined;
4386
- /** Optional. The window to restrict the search to. If omitted, returns all views. */
4376
+ /** The window to restrict the search to. If omitted, returns all views. */
4387
4377
  windowId?: number | undefined;
4388
- /** Optional. The type of view to get. If omitted, returns all views (including background pages and tabs). Valid values: 'tab', 'notification', 'popup'. */
4389
- type?: string | undefined;
4378
+ /** The type of view to get. If omitted, returns all views (including background pages and tabs). */
4379
+ type?: `${ViewType}` | undefined;
4390
4380
  }
4391
4381
 
4392
- export interface LastError {
4393
- /** Description of the error that has taken place. */
4394
- message: string;
4395
- }
4396
-
4397
- export interface OnRequestEvent extends
4398
- chrome.events.Event<
4399
- | ((request: any, sender: runtime.MessageSender, sendResponse: (response: any) => void) => void)
4400
- | ((sender: runtime.MessageSender, sendResponse: (response: any) => void) => void)
4401
- >
4402
- {}
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;
4403
4384
 
4404
4385
  /**
4405
- * @since Chrome 7
4406
- * 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.
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}
4407
4388
  */
4408
- export var inIncognitoContext: boolean;
4409
- /** 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. */
4410
- export var lastError: LastError;
4389
+ export const lastError: runtime.LastError | undefined;
4411
4390
 
4412
4391
  /** Returns the JavaScript 'window' object for the background page running inside the current extension. Returns null if the extension has no background page. */
4413
4392
  export function getBackgroundPage(): Window | null;
4393
+
4414
4394
  /**
4415
4395
  * Converts a relative path within an extension install directory to a fully-qualified URL.
4416
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}
4417
4398
  */
4418
4399
  export function getURL(path: string): string;
4419
- /**
4420
- * 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.
4421
- * @since Chrome 9
4422
- */
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. */
4423
4402
  export function setUpdateUrlData(data: string): void;
4403
+
4424
4404
  /** Returns an array of the JavaScript 'window' objects for each of the pages running inside the current extension. */
4425
4405
  export function getViews(fetchProperties?: FetchProperties): Window[];
4406
+
4426
4407
  /**
4427
- * Retrieves the state of the extension's access to the 'file://' scheme (as determined by the user-controlled 'Allow access to File URLs' checkbox.
4428
- * @since Chrome 12
4429
- * @return The `isAllowedFileSchemeAccess` method provides its result via callback or returned as a `Promise` (MV3 only).
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.
4430
4411
  */
4431
4412
  export function isAllowedFileSchemeAccess(): Promise<boolean>;
4432
- /**
4433
- * Retrieves the state of the extension's access to the 'file://' scheme (as determined by the user-controlled 'Allow access to File URLs' checkbox.
4434
- * @since Chrome 12
4435
- * Parameter isAllowedAccess: True if the extension can access the 'file://' scheme, false otherwise.
4436
- */
4437
4413
  export function isAllowedFileSchemeAccess(callback: (isAllowedAccess: boolean) => void): void;
4414
+
4438
4415
  /**
4439
- * Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in Incognito' checkbox.
4440
- * @since Chrome 12
4441
- * @return The `isAllowedIncognitoAccess` method provides its result via callback or returned as a `Promise` (MV3 only).
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.
4442
4419
  */
4443
4420
  export function isAllowedIncognitoAccess(): Promise<boolean>;
4444
- /**
4445
- * Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in Incognito' checkbox.
4446
- * @since Chrome 12
4447
- * Parameter isAllowedAccess: True if the extension has access to Incognito mode, false otherwise.
4448
- */
4449
4421
  export function isAllowedIncognitoAccess(callback: (isAllowedAccess: boolean) => void): void;
4422
+
4450
4423
  /**
4451
- * 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.
4452
- * @deprecated Deprecated since Chrome 33. Please use runtime.sendMessage.
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
4453
4427
  * @param extensionId The extension ID of the extension you want to connect to. If omitted, default is your own extension.
4454
- * @param responseCallback If you specify the responseCallback parameter, it should be a function that looks like this:
4455
- * function(any response) {...};
4456
- * 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}
4457
4429
  */
4458
4430
  export function sendRequest<Request = any, Response = any>(
4459
- extensionId: string,
4431
+ extensionId: string | undefined,
4460
4432
  request: Request,
4461
- responseCallback?: (response: Response) => void,
4433
+ callback?: (response: Response) => void,
4462
4434
  ): void;
4463
- /**
4464
- * 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.
4465
- * @deprecated Deprecated since Chrome 33. Please use runtime.sendMessage.
4466
- * @param responseCallback If you specify the responseCallback parameter, it should be a function that looks like this:
4467
- * function(any response) {...};
4468
- * 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.
4469
- */
4470
4435
  export function sendRequest<Request = any, Response = any>(
4471
4436
  request: Request,
4472
- responseCallback?: (response: Response) => void,
4437
+ callback?: (response: Response) => void,
4473
4438
  ): void;
4439
+
4474
4440
  /**
4475
- * 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.
4476
- * @deprecated Deprecated since Chrome 33. Please use extension.getViews {type: "tab"}.
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"}`.
4477
4445
  */
4478
4446
  export function getExtensionTabs(windowId?: number): Window[];
4479
4447
 
4480
4448
  /**
4481
4449
  * Fired when a request is sent from either an extension process or a content script.
4482
- * @deprecated Deprecated since Chrome 33. Please use runtime.onMessage.
4450
+ *
4451
+ * MV2 only
4452
+ * @deprecated Please use {@link runtime.onMessage}.
4483
4453
  */
4484
- export var onRequest: OnRequestEvent;
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
+
4485
4459
  /**
4486
4460
  * Fired when a request is sent from another extension.
4487
- * @deprecated Deprecated since Chrome 33. Please use runtime.onMessageExternal.
4461
+ *
4462
+ * MV2 only
4463
+ * @deprecated Please use {@link runtime.onMessageExternal}.
4488
4464
  */
4489
- export var onRequestExternal: OnRequestEvent;
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
+ >;
4490
4469
  }
4491
4470
 
4492
4471
  ////////////////////
@@ -4577,47 +4556,16 @@ declare namespace chrome {
4577
4556
  * @platform ChromeOS only
4578
4557
  */
4579
4558
  export namespace fileBrowserHandler {
4580
- export interface SelectionParams {
4581
- /**
4582
- * Optional.
4583
- * 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']
4584
- * @since Chrome 23
4585
- */
4586
- allowedFileExtensions?: string[] | undefined;
4587
- /** Suggested name for the file. */
4588
- suggestedName: string;
4589
- }
4590
-
4591
- export interface SelectionResult {
4592
- /** Optional. Selected file entry. It will be null if a file hasn't been selected. */
4593
- entry?: object | null | undefined;
4594
- /** Whether the file has been selected. */
4595
- success: boolean;
4596
- }
4597
-
4598
4559
  /** Event details payload for fileBrowserHandler.onExecute event. */
4599
4560
  export interface FileHandlerExecuteEventDetails {
4600
- /** Optional. The ID of the tab that raised this event. Tab IDs are unique within a browser session. */
4601
- tab_id?: number | undefined;
4561
+ /** The ID of the tab that raised this event. Tab IDs are unique within a browser session. */
4562
+ tab_id?: number;
4602
4563
  /** Array of Entry instances representing files that are targets of this action (selected in ChromeOS file browser). */
4603
4564
  entries: any[];
4604
4565
  }
4605
4566
 
4606
- export interface FileBrowserHandlerExecuteEvent
4607
- extends chrome.events.Event<(id: string, details: FileHandlerExecuteEventDetails) => void>
4608
- {}
4609
-
4610
- /**
4611
- * 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.
4612
- * @since Chrome 21
4613
- * @param selectionParams Parameters that will be used while selecting the file.
4614
- * @param callback Function called upon completion.
4615
- * Parameter result: Result of the method.
4616
- */
4617
- export function selectFile(selectionParams: SelectionParams, callback: (result: SelectionResult) => void): void;
4618
-
4619
4567
  /** Fired when file system action is executed from ChromeOS file browser. */
4620
- export var onExecute: FileBrowserHandlerExecuteEvent;
4568
+ export const onExecute: events.Event<(id: string, details: FileHandlerExecuteEventDetails) => void>;
4621
4569
  }
4622
4570
 
4623
4571
  ////////////////////
@@ -5400,212 +5348,382 @@ declare namespace chrome {
5400
5348
  fontId: string;
5401
5349
  }
5402
5350
 
5403
- export interface DefaultFontSizeDetails {
5404
- /** The font size in pixels. */
5405
- pixelSize: number;
5406
- }
5407
-
5408
- export interface FontDetails {
5409
- /** The generic font family for the font. */
5410
- genericFamily:
5411
- | "cursive"
5412
- | "fantasy"
5413
- | "fixed"
5414
- | "sansserif"
5415
- | "serif"
5416
- | "standard";
5417
- /** Optional. The script for the font. If omitted, the global script font setting is affected. */
5418
- script?: string | undefined;
5351
+ /** A CSS generic font family. */
5352
+ export enum GenericFamily {
5353
+ STANDARD = "standard",
5354
+ SANSSERIF = "sansserif",
5355
+ SERIF = "serif",
5356
+ FIXED = "fixed",
5357
+ CURSIVE = "cursive",
5358
+ FANTASY = "fantasy",
5359
+ MATH = "math",
5360
+ }
5361
+
5362
+ export enum LevelOfControl {
5363
+ /** Cannot be controlled by any extension */
5364
+ NOT_CONTROLLABLE = "not_controllable",
5365
+ /** Controlled by extensions with higher precedence */
5366
+ CONTROLLED_BY_OTHER_EXTENSIONS = "controlled_by_other_extensions",
5367
+ /** Can be controlled by this extension */
5368
+ CONTROLLABLE_BY_THIS_EXTENSION = "controllable_by_this_extension",
5369
+ /** Controlled by this extension */
5370
+ CONTROLLED_BY_THIS_EXTENSION = "controlled_by_this_extension",
5371
+ }
5372
+
5373
+ /** An ISO 15924 script code. The default, or global, script is represented by script code "Zyyy". */
5374
+ export enum ScriptCode {
5375
+ AFAK = "Afak",
5376
+ ARAB = "Arab",
5377
+ ARMI = "Armi",
5378
+ ARMN = "Armn",
5379
+ AVST = "Avst",
5380
+ BALI = "Bali",
5381
+ BAMU = "Bamu",
5382
+ BASS = "Bass",
5383
+ BATK = "Batk",
5384
+ BENG = "Beng",
5385
+ BLIS = "Blis",
5386
+ BOPO = "Bopo",
5387
+ BRAH = "Brah",
5388
+ BRAI = "Brai",
5389
+ BUGI = "Bugi",
5390
+ BUHD = "Buhd",
5391
+ CAKM = "Cakm",
5392
+ CANS = "Cans",
5393
+ CARI = "Cari",
5394
+ CHAM = "Cham",
5395
+ CHER = "Cher",
5396
+ CIRT = "Cirt",
5397
+ COPT = "Copt",
5398
+ CPRT = "Cprt",
5399
+ CYRL = "Cyrl",
5400
+ CYRS = "Cyrs",
5401
+ DEVA = "Deva",
5402
+ DSRT = "Dsrt",
5403
+ DUPL = "Dupl",
5404
+ EGYD = "Egyd",
5405
+ EGYH = "Egyh",
5406
+ EGYP = "Egyp",
5407
+ ELBA = "Elba",
5408
+ ETHI = "Ethi",
5409
+ GEOK = "Geok",
5410
+ GEOR = "Geor",
5411
+ GLAG = "Glag",
5412
+ GOTH = "Goth",
5413
+ GRAN = "Gran",
5414
+ GREK = "Grek",
5415
+ GUJR = "Gujr",
5416
+ GURU = "Guru",
5417
+ HANG = "Hang",
5418
+ HANI = "Hani",
5419
+ HANO = "Hano",
5420
+ HANS = "Hans",
5421
+ HANT = "Hant",
5422
+ HEBR = "Hebr",
5423
+ HLUW = "Hluw",
5424
+ HMNG = "Hmng",
5425
+ HUNG = "Hung",
5426
+ INDS = "Inds",
5427
+ ITAL = "Ital",
5428
+ JAVA = "Java",
5429
+ JPAN = "Jpan",
5430
+ JURC = "Jurc",
5431
+ KALI = "Kali",
5432
+ KHAR = "Khar",
5433
+ KHMR = "Khmr",
5434
+ KHOJ = "Khoj",
5435
+ KNDA = "Knda",
5436
+ KPEL = "Kpel",
5437
+ KTHI = "Kthi",
5438
+ LANA = "Lana",
5439
+ LAOO = "Laoo",
5440
+ LATF = "Latf",
5441
+ LATG = "Latg",
5442
+ LATN = "Latn",
5443
+ LEPC = "Lepc",
5444
+ LIMB = "Limb",
5445
+ LINA = "Lina",
5446
+ LINB = "Linb",
5447
+ LISU = "Lisu",
5448
+ LOMA = "Loma",
5449
+ LYCI = "Lyci",
5450
+ LYDI = "Lydi",
5451
+ MAND = "Mand",
5452
+ MANI = "Mani",
5453
+ MAYA = "Maya",
5454
+ MEND = "Mend",
5455
+ MERC = "Merc",
5456
+ MERO = "Mero",
5457
+ MLYM = "Mlym",
5458
+ MONG = "Mong",
5459
+ MOON = "Moon",
5460
+ MROO = "Mroo",
5461
+ MTEI = "Mtei",
5462
+ MYMR = "Mymr",
5463
+ NARB = "Narb",
5464
+ NBAT = "Nbat",
5465
+ NKGB = "Nkgb",
5466
+ NKOO = "Nkoo",
5467
+ NSHU = "Nshu",
5468
+ OGAM = "Ogam",
5469
+ OLCK = "Olck",
5470
+ ORKH = "Orkh",
5471
+ ORYA = "Orya",
5472
+ OSMA = "Osma",
5473
+ PALM = "Palm",
5474
+ PERM = "Perm",
5475
+ PHAG = "Phag",
5476
+ PHLI = "Phli",
5477
+ PHLP = "Phlp",
5478
+ PHLV = "Phlv",
5479
+ PHNX = "Phnx",
5480
+ PLRD = "Plrd",
5481
+ PRTI = "Prti",
5482
+ RJNG = "Rjng",
5483
+ RORO = "Roro",
5484
+ RUNR = "Runr",
5485
+ SAMR = "Samr",
5486
+ SARA = "Sara",
5487
+ SARB = "Sarb",
5488
+ SAUR = "Saur",
5489
+ SGNW = "Sgnw",
5490
+ SHAW = "Shaw",
5491
+ SHRD = "Shrd",
5492
+ SIND = "Sind",
5493
+ SINH = "Sinh",
5494
+ SORA = "Sora",
5495
+ SUND = "Sund",
5496
+ SYLO = "Sylo",
5497
+ SYRC = "Syrc",
5498
+ SYRE = "Syre",
5499
+ SYRJ = "Syrj",
5500
+ SYRN = "Syrn",
5501
+ TAGB = "Tagb",
5502
+ TAKR = "Takr",
5503
+ TALE = "Tale",
5504
+ TALU = "Talu",
5505
+ TAML = "Taml",
5506
+ TANG = "Tang",
5507
+ TAVT = "Tavt",
5508
+ TELU = "Telu",
5509
+ TENG = "Teng",
5510
+ TFNG = "Tfng",
5511
+ TGLG = "Tglg",
5512
+ THAA = "Thaa",
5513
+ THAI = "Thai",
5514
+ TIBT = "Tibt",
5515
+ TIRH = "Tirh",
5516
+ UGAR = "Ugar",
5517
+ VAII = "Vaii",
5518
+ VISP = "Visp",
5519
+ WARA = "Wara",
5520
+ WOLE = "Wole",
5521
+ XPEO = "Xpeo",
5522
+ XSUX = "Xsux",
5523
+ YIII = "Yiii",
5524
+ ZMTH = "Zmth",
5525
+ ZSYM = "Zsym",
5526
+ ZYYY = "Zyyy",
5527
+ }
5528
+
5529
+ export interface ClearFontDetails {
5530
+ /** The generic font family for which the font should be cleared. */
5531
+ genericFamily: `${GenericFamily}`;
5532
+ /** The script for which the font should be cleared. If omitted, the global script font setting is cleared. */
5533
+ script?: `${ScriptCode}` | undefined;
5534
+ }
5535
+
5536
+ export interface GetFontDetails {
5537
+ /** The generic font family for which the font should be retrieved. */
5538
+ genericFamily: `${GenericFamily}`;
5539
+ /** The script for which the font should be retrieved. If omitted, the font setting for the global script (script code "Zyyy") is retrieved. */
5540
+ script?: `${ScriptCode}` | undefined;
5541
+ }
5542
+
5543
+ export interface SetFontDetails {
5544
+ /** The font ID. The empty string means to fallback to the global script font setting. */
5545
+ fontId: string;
5546
+ /** The generic font family for which the font should be set. */
5547
+ genericFamily: `${GenericFamily}`;
5548
+ /** The script code which the font should be set. If omitted, the font setting for the global script (script code "Zyyy") is set. */
5549
+ script?: `${ScriptCode}` | undefined;
5419
5550
  }
5420
5551
 
5421
- export interface FullFontDetails {
5552
+ export interface FontChangedResult {
5422
5553
  /** The generic font family for which the font setting has changed. */
5423
- genericFamily: string;
5554
+ genericFamily: `${GenericFamily}`;
5424
5555
  /** The level of control this extension has over the setting. */
5425
- levelOfControl: string;
5556
+ levelOfControl: `${LevelOfControl}`;
5426
5557
  /** Optional. The script code for which the font setting has changed. */
5427
- script?: string | undefined;
5428
- /** The font ID. See the description in getFont. */
5558
+ script?: `${ScriptCode}`;
5559
+ /** The font ID. See the description in {@link getFont}. */
5429
5560
  fontId: string;
5430
5561
  }
5431
5562
 
5432
- export interface FontDetailsResult {
5563
+ export interface FontResult {
5433
5564
  /** The level of control this extension has over the setting. */
5434
- levelOfControl: string;
5435
- /** The font ID. Rather than the literal font ID preference value, this may be the ID of the font that the system resolves the preference value to. So, fontId can differ from the font passed to setFont, if, for example, the font is not available on the system. The empty string signifies fallback to the global script font setting. */
5565
+ levelOfControl: `${LevelOfControl}`;
5566
+ /** The font ID. Rather than the literal font ID preference value, this may be the ID of the font that the system resolves the preference value to. So, `fontId` can differ from the font passed to {@link setFont}, if, for example, the font is not available on the system. The empty string signifies fallback to the global script font setting. */
5436
5567
  fontId: string;
5437
5568
  }
5438
5569
 
5439
- export interface FontSizeDetails {
5570
+ export interface FontSizeResult {
5440
5571
  /** The font size in pixels. */
5441
5572
  pixelSize: number;
5442
5573
  /** The level of control this extension has over the setting. */
5443
- levelOfControl: string;
5574
+ levelOfControl: `${LevelOfControl}`;
5444
5575
  }
5445
5576
 
5446
- export interface SetFontSizeDetails {
5577
+ export interface FontSizeDetails {
5447
5578
  /** The font size in pixels. */
5448
5579
  pixelSize: number;
5449
5580
  }
5450
5581
 
5451
- export interface SetFontDetails extends FontDetails {
5452
- /** The font ID. The empty string means to fallback to the global script font setting. */
5453
- fontId: string;
5454
- }
5455
-
5456
- export interface DefaultFixedFontSizeChangedEvent
5457
- extends chrome.events.Event<(details: FontSizeDetails) => void>
5458
- {}
5459
-
5460
- export interface DefaultFontSizeChangedEvent extends chrome.events.Event<(details: FontSizeDetails) => void> {}
5461
-
5462
- export interface MinimumFontSizeChangedEvent extends chrome.events.Event<(details: FontSizeDetails) => void> {}
5463
-
5464
- export interface FontChangedEvent extends chrome.events.Event<(details: FullFontDetails) => void> {}
5465
-
5466
5582
  /**
5467
5583
  * Sets the default font size.
5468
- * @return The `setDefaultFontSize` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5469
- */
5470
- export function setDefaultFontSize(details: DefaultFontSizeDetails): Promise<void>;
5471
- /**
5472
- * Sets the default font size.
5473
- */
5474
- export function setDefaultFontSize(details: DefaultFontSizeDetails, callback: () => void): void;
5475
- /**
5476
- * Gets the font for a given script and generic font family.
5477
- * @return The `getFont` method provides its result via callback or returned as a `Promise` (MV3 only).
5584
+ *
5585
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5478
5586
  */
5479
- export function getFont(details: FontDetails): Promise<FontDetailsResult>;
5587
+ export function setDefaultFontSize(details: FontSizeDetails): Promise<void>;
5588
+ export function setDefaultFontSize(details: FontSizeDetails, callback: () => void): void;
5589
+
5480
5590
  /**
5481
5591
  * Gets the font for a given script and generic font family.
5592
+ *
5593
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5482
5594
  */
5483
- export function getFont(details: FontDetails, callback: (details: FontDetailsResult) => void): void;
5484
- /**
5485
- * Gets the default font size.
5486
- * @param details This parameter is currently unused.
5487
- * @return The `getDefaultFontSize` method provides its result via callback or returned as a `Promise` (MV3 only).
5488
- */
5489
- export function getDefaultFontSize(details?: unknown): Promise<FontSizeDetails>;
5595
+ export function getFont(details: GetFontDetails): Promise<FontResult>;
5596
+ export function getFont(details: GetFontDetails, callback: (details: FontResult) => void): void;
5597
+
5490
5598
  /**
5491
5599
  * Gets the default font size.
5492
5600
  * @param details This parameter is currently unused.
5601
+ *
5602
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5493
5603
  */
5494
- export function getDefaultFontSize(callback: (options: FontSizeDetails) => void): void;
5495
- export function getDefaultFontSize(details: unknown, callback: (options: FontSizeDetails) => void): void;
5496
- /**
5497
- * Gets the minimum font size.
5498
- * @param details This parameter is currently unused.
5499
- * @return The `getMinimumFontSize` method provides its result via callback or returned as a `Promise` (MV3 only).
5500
- */
5501
- export function getMinimumFontSize(details?: unknown): Promise<FontSizeDetails>;
5604
+ export function getDefaultFontSize(details?: { [key: string]: unknown }): Promise<FontSizeResult>;
5605
+ export function getDefaultFontSize(callback: (options: FontSizeResult) => void): void;
5606
+ export function getDefaultFontSize(
5607
+ details: { [key: string]: unknown } | undefined,
5608
+ callback: (options: FontSizeResult) => void,
5609
+ ): void;
5610
+
5502
5611
  /**
5503
5612
  * Gets the minimum font size.
5504
5613
  * @param details This parameter is currently unused.
5614
+ *
5615
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5505
5616
  */
5506
- export function getMinimumFontSize(callback: (options: FontSizeDetails) => void): void;
5507
- export function getMinimumFontSize(details: unknown, callback: (options: FontSizeDetails) => void): void;
5508
- /**
5509
- * Sets the minimum font size.
5510
- * @return The `setMinimumFontSize` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5511
- */
5512
- export function setMinimumFontSize(details: SetFontSizeDetails): Promise<void>;
5617
+ export function getMinimumFontSize(details?: { [key: string]: unknown }): Promise<FontSizeResult>;
5618
+ export function getMinimumFontSize(callback: (options: FontSizeResult) => void): void;
5619
+ export function getMinimumFontSize(
5620
+ details: { [key: string]: unknown } | undefined,
5621
+ callback: (options: FontSizeResult) => void,
5622
+ ): void;
5623
+
5513
5624
  /**
5514
5625
  * Sets the minimum font size.
5626
+ *
5627
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5515
5628
  */
5516
- export function setMinimumFontSize(details: SetFontSizeDetails, callback: () => void): void;
5517
- /**
5518
- * Gets the default size for fixed width fonts.
5519
- * @param details This parameter is currently unused.
5520
- * @return The `getDefaultFixedFontSize` method provides its result via callback or returned as a `Promise` (MV3 only).
5521
- */
5522
- export function getDefaultFixedFontSize(details?: unknown): Promise<FontSizeDetails>;
5629
+ export function setMinimumFontSize(details: FontSizeDetails): Promise<void>;
5630
+ export function setMinimumFontSize(details: FontSizeDetails, callback: () => void): void;
5631
+
5523
5632
  /**
5524
5633
  * Gets the default size for fixed width fonts.
5525
5634
  * @param details This parameter is currently unused.
5635
+ *
5636
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5526
5637
  */
5527
- export function getDefaultFixedFontSize(callback: (details: FontSizeDetails) => void): void;
5528
- export function getDefaultFixedFontSize(details: unknown, callback: (details: FontSizeDetails) => void): void;
5529
- /**
5530
- * Clears the default font size set by this extension, if any.
5531
- * @param details This parameter is currently unused.
5532
- * @return The `clearDefaultFontSize` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5533
- */
5534
- export function clearDefaultFontSize(details?: unknown): Promise<void>;
5638
+ export function getDefaultFixedFontSize(details?: { [key: string]: unknown }): Promise<FontSizeResult>;
5639
+ export function getDefaultFixedFontSize(callback: (details: FontSizeResult) => void): void;
5640
+ export function getDefaultFixedFontSize(
5641
+ details: { [key: string]: unknown } | undefined,
5642
+ callback: (details: FontSizeResult) => void,
5643
+ ): void;
5644
+
5535
5645
  /**
5536
5646
  * Clears the default font size set by this extension, if any.
5537
5647
  * @param details This parameter is currently unused.
5648
+ *
5649
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5538
5650
  */
5651
+ export function clearDefaultFontSize(details?: { [key: string]: unknown }): Promise<void>;
5539
5652
  export function clearDefaultFontSize(callback: () => void): void;
5540
- export function clearDefaultFontSize(details: unknown, callback: () => void): void;
5541
- /**
5542
- * Sets the default size for fixed width fonts.
5543
- * @return The `setDefaultFixedFontSize` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5544
- */
5545
- export function setDefaultFixedFontSize(details: SetFontSizeDetails): Promise<void>;
5653
+ export function clearDefaultFontSize(
5654
+ details: { [key: string]: unknown } | undefined,
5655
+ callback: () => void,
5656
+ ): void;
5657
+
5546
5658
  /**
5547
5659
  * Sets the default size for fixed width fonts.
5660
+ *
5661
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5548
5662
  */
5549
- export function setDefaultFixedFontSize(details: SetFontSizeDetails, callback: () => void): void;
5550
- /**
5551
- * Clears the font set by this extension, if any.
5552
- * @return The `clearFont` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5553
- */
5554
- export function clearFont(details: FontDetails): Promise<void>;
5663
+ export function setDefaultFixedFontSize(details: FontSizeDetails): Promise<void>;
5664
+ export function setDefaultFixedFontSize(details: FontSizeDetails, callback: () => void): void;
5665
+
5555
5666
  /**
5556
5667
  * Clears the font set by this extension, if any.
5668
+ *
5669
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5557
5670
  */
5558
- export function clearFont(details: FontDetails, callback: () => void): void;
5671
+ export function clearFont(details: ClearFontDetails): Promise<void>;
5672
+ export function clearFont(details: ClearFontDetails, callback: () => void): void;
5673
+
5559
5674
  /**
5560
5675
  * Sets the font for a given script and generic font family.
5561
- * @return The `setFont` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5676
+ *
5677
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5562
5678
  */
5563
5679
  export function setFont(details: SetFontDetails): Promise<void>;
5564
- /**
5565
- * Sets the font for a given script and generic font family.
5566
- */
5567
5680
  export function setFont(details: SetFontDetails, callback: () => void): void;
5681
+
5568
5682
  /**
5569
5683
  * Clears the minimum font size set by this extension, if any.
5570
5684
  * @param details This parameter is currently unused.
5571
- * @return The `clearMinimumFontSize` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5572
- */
5573
- export function clearMinimumFontSize(details?: unknown): Promise<void>;
5574
- /**
5575
- * Clears the minimum font size set by this extension, if any.
5576
- * @param details This parameter is currently unused.
5685
+ *
5686
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5577
5687
  */
5688
+ export function clearMinimumFontSize(details?: { [key: string]: unknown }): Promise<void>;
5578
5689
  export function clearMinimumFontSize(callback: () => void): void;
5579
- export function clearMinimumFontSize(details: unknown, callback: () => void): void;
5690
+ export function clearMinimumFontSize(
5691
+ details: { [key: string]: unknown } | undefined,
5692
+ callback: () => void,
5693
+ ): void;
5694
+
5580
5695
  /**
5581
5696
  * Gets a list of fonts on the system.
5582
- * @return The `getFontList` method provides its result via callback or returned as a `Promise` (MV3 only).
5697
+ *
5698
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5583
5699
  */
5584
5700
  export function getFontList(): Promise<FontName[]>;
5585
- /**
5586
- * Gets a list of fonts on the system.
5587
- */
5588
5701
  export function getFontList(callback: (results: FontName[]) => void): void;
5702
+
5589
5703
  /**
5590
5704
  * Clears the default fixed font size set by this extension, if any.
5591
5705
  * @param details This parameter is currently unused.
5592
- * @return The `clearDefaultFixedFontSize` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5593
- */
5594
- export function clearDefaultFixedFontSize(details: unknown): Promise<void>;
5595
- /**
5596
- * Clears the default fixed font size set by this extension, if any.
5597
- * @param details This parameter is currently unused.
5706
+ *
5707
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5598
5708
  */
5599
- export function clearDefaultFixedFontSize(details: unknown, callback: () => void): void;
5709
+ export function clearDefaultFixedFontSize(details?: { [key: string]: unknown }): Promise<void>;
5710
+ export function clearDefaultFixedFontSize(callback: () => void): void;
5711
+ export function clearDefaultFixedFontSize(
5712
+ details: { [key: string]: unknown } | undefined,
5713
+ callback: () => void,
5714
+ ): void;
5600
5715
 
5601
5716
  /** Fired when the default fixed font size setting changes. */
5602
- export var onDefaultFixedFontSizeChanged: DefaultFixedFontSizeChangedEvent;
5717
+ export const onDefaultFixedFontSizeChanged: events.Event<(details: FontSizeResult) => void>;
5718
+
5603
5719
  /** Fired when the default font size setting changes. */
5604
- export var onDefaultFontSizeChanged: DefaultFontSizeChangedEvent;
5720
+ export const onDefaultFontSizeChanged: events.Event<(details: FontSizeResult) => void>;
5721
+
5605
5722
  /** Fired when the minimum font size setting changes. */
5606
- export var onMinimumFontSizeChanged: MinimumFontSizeChangedEvent;
5723
+ export const onMinimumFontSizeChanged: events.Event<(details: FontSizeResult) => void>;
5724
+
5607
5725
  /** Fired when a font setting changes. */
5608
- export var onFontChanged: FontChangedEvent;
5726
+ export const onFontChanged: events.Event<(details: FontChangedResult) => void>;
5609
5727
  }
5610
5728
 
5611
5729
  ////////////////////
@@ -5828,58 +5946,56 @@ declare namespace chrome {
5828
5946
  * Manifest: "default_locale"
5829
5947
  */
5830
5948
  export namespace i18n {
5831
- /** Holds detected ISO language code and its percentage in the input string */
5832
5949
  export interface DetectedLanguage {
5833
- /** An ISO language code such as 'en' or 'fr'.
5834
- * 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}.
5835
- * For an unknown language, 'und' will be returned, which means that [percentage] of the text is unknown to CLD */
5836
5950
  language: string;
5837
-
5838
5951
  /** The percentage of the detected language */
5839
5952
  percentage: number;
5840
5953
  }
5841
5954
 
5842
- /** Holds detected language reliability and array of DetectedLanguage */
5955
+ /** Holds detected language reliability and array of {@link DetectedLanguage} */
5843
5956
  export interface LanguageDetectionResult {
5844
5957
  /** CLD detected language reliability */
5845
5958
  isReliable: boolean;
5846
-
5847
5959
  /** Array of detectedLanguage */
5848
5960
  languages: DetectedLanguage[];
5849
5961
  }
5850
5962
 
5963
+ /** @since Chrome 79 */
5964
+ export interface GetMessageOptions {
5965
+ /** Escape `<` in translation to `&lt;`. 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. */
5966
+ escapeLt?: boolean | undefined;
5967
+ }
5968
+
5851
5969
  /**
5852
- * Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use i18n.getUILanguage.
5853
- * @return The `getAcceptLanguages` method provides its result via callback or returned as a `Promise` (MV3 only).
5854
- * @since MV3
5970
+ * 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}.
5971
+ *
5972
+ * Can return its result via Promise in Manifest V3 or later since Chrome 99.
5855
5973
  */
5856
5974
  export function getAcceptLanguages(): Promise<string[]>;
5857
- /**
5858
- * Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use i18n.getUILanguage.
5859
- * Parameter languages: Array of the accept languages of the browser, such as en-US,en,zh-CN
5860
- */
5861
5975
  export function getAcceptLanguages(callback: (languages: string[]) => void): void;
5976
+
5862
5977
  /**
5863
- * 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.
5864
- * @param messageName The name of the message, as specified in the messages.json file.
5865
- * @param substitutions Optional. Up to 9 substitution strings, if the message requires any.
5866
- */
5867
- export function getMessage(messageName: string, substitutions?: string | string[]): string;
5868
- /**
5869
- * Gets the browser UI language of the browser. This is different from i18n.getAcceptLanguages which returns the preferred user languages.
5870
- * @since Chrome 35
5978
+ * 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`.
5979
+ * @param messageName The name of the message, as specified in the `messages.json` file.
5980
+ * @param substitutions Up to 9 substitution strings, if the message requires any.
5871
5981
  */
5982
+ export function getMessage(messageName: string, substitutions?: string | Array<string | number>): string;
5983
+ export function getMessage(
5984
+ messageName: string,
5985
+ substitutions: string | Array<string | number> | undefined,
5986
+ options?: GetMessageOptions,
5987
+ ): string;
5988
+
5989
+ /** Gets the browser UI language of the browser. This is different from {@link i18n.getAcceptLanguages} which returns the preferred user languages. */
5872
5990
  export function getUILanguage(): string;
5873
5991
 
5874
5992
  /** Detects the language of the provided text using CLD.
5875
5993
  * @param text User input string to be translated.
5876
- * @return The `detectLanguage` method provides its result via callback or returned as a `Promise` (MV3 only).
5877
- * @since MV3
5994
+ *
5995
+ * Can return its result via Promise in Manifest V3 or later since Chrome 99.
5996
+ * @since Chrome 47
5878
5997
  */
5879
5998
  export function detectLanguage(text: string): Promise<LanguageDetectionResult>;
5880
- /** Detects the language of the provided text using CLD.
5881
- * @param text User input string to be translated.
5882
- */
5883
5999
  export function detectLanguage(text: string, callback: (result: LanguageDetectionResult) => void): void;
5884
6000
  }
5885
6001
 
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
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": "e1847839136a21eca4a5e3d9983e414a4cc25f314b870dc6c424dbeacdcb8b35",
97
+ "typesPublisherContentHash": "122b50fdcaab1f9e2ae48df62d855a130565fcffb4cdd9d84554c64ba36746d1",
98
98
  "typeScriptVersion": "5.2"
99
99
  }