@types/chrome 0.0.314 → 0.0.316

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 +244 -269
  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: Fri, 11 Apr 2025 21:33:04 GMT
11
+ * Last updated: Tue, 22 Apr 2025 15:36:51 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
@@ -1865,198 +1865,146 @@ declare namespace chrome {
1865
1865
  * Permissions: "contextMenus"
1866
1866
  */
1867
1867
  export namespace contextMenus {
1868
- export interface OnClickData {
1869
- /**
1870
- * Optional.
1871
- * @since Chrome 35
1872
- * The text for the context selection, if any.
1873
- */
1874
- selectionText?: string | undefined;
1875
- /**
1876
- * Optional.
1877
- * @since Chrome 35
1878
- * A flag indicating the state of a checkbox or radio item after it is clicked.
1879
- */
1880
- checked?: boolean | undefined;
1881
- /**
1882
- * @since Chrome 35
1883
- * The ID of the menu item that was clicked.
1884
- */
1885
- menuItemId: number | string;
1886
- /**
1887
- * Optional.
1888
- * @since Chrome 35
1889
- * The ID of the frame of the element where the context menu was
1890
- * clicked, if it was in a frame.
1891
- */
1892
- frameId?: number | undefined;
1893
- /**
1894
- * Optional.
1895
- * @since Chrome 35
1896
- * The URL of the frame of the element where the context menu was clicked, if it was in a frame.
1897
- */
1898
- frameUrl?: string | undefined;
1899
- /**
1900
- * @since Chrome 35
1901
- * A flag indicating whether the element is editable (text input, textarea, etc.).
1902
- */
1903
- editable: boolean;
1904
- /**
1905
- * Optional.
1906
- * @since Chrome 35
1907
- * One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements.
1908
- */
1909
- mediaType?: "image" | "video" | "audio" | undefined;
1910
- /**
1911
- * Optional.
1912
- * @since Chrome 35
1913
- * A flag indicating the state of a checkbox or radio item before it was clicked.
1914
- */
1915
- wasChecked?: boolean | undefined;
1916
- /**
1917
- * @since Chrome 35
1918
- * The URL of the page where the menu item was clicked. This property is not set if the click occurred in a context where there is no current page, such as in a launcher context menu.
1919
- */
1920
- pageUrl: string;
1921
- /**
1922
- * Optional.
1923
- * @since Chrome 35
1924
- * If the element is a link, the URL it points to.
1925
- */
1926
- linkUrl?: string | undefined;
1927
- /**
1928
- * Optional.
1929
- * @since Chrome 35
1930
- * The parent ID, if any, for the item clicked.
1931
- */
1932
- parentMenuItemId?: number | string;
1933
- /**
1934
- * Optional.
1935
- * @since Chrome 35
1936
- * Will be present for elements with a 'src' URL.
1937
- */
1938
- srcUrl?: string | undefined;
1868
+ /**
1869
+ * The different contexts a menu can appear in. Specifying 'all' is equivalent to the combination of all other contexts except for 'launcher'. The 'launcher' context is only supported by apps and is used to add menu items to the context menu that appears when clicking the app icon in the launcher/taskbar/dock/etc. Different platforms might put limitations on what is actually supported in a launcher context menu.
1870
+ * @since Chrome 44
1871
+ */
1872
+ export enum ContextType {
1873
+ ALL = "all",
1874
+ PAGE = "page",
1875
+ FRAME = "frame",
1876
+ SELECTION = "selection",
1877
+ LINK = "link",
1878
+ EDITABLE = "editable",
1879
+ IMAGE = "image",
1880
+ VIDEO = "video",
1881
+ AUDIO = "audio",
1882
+ LAUNCHER = "launcher",
1883
+ BROWSER_ACTION = "browser_action",
1884
+ PAGE_ACTION = "page_action",
1885
+ ACTION = "action",
1939
1886
  }
1940
1887
 
1941
- type ContextType =
1942
- | "all"
1943
- | "page"
1944
- | "frame"
1945
- | "selection"
1946
- | "link"
1947
- | "editable"
1948
- | "image"
1949
- | "video"
1950
- | "audio"
1951
- | "launcher"
1952
- | "browser_action"
1953
- | "page_action"
1954
- | "action";
1955
-
1956
- type ContextItemType = "normal" | "checkbox" | "radio" | "separator";
1957
-
1888
+ /**
1889
+ * Properties of the new context menu item.
1890
+ * @since Chrome 123
1891
+ */
1958
1892
  export interface CreateProperties {
1959
- /** Optional. Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see Match Patterns. */
1960
- documentUrlPatterns?: string[] | undefined;
1961
- /** Optional. The initial state of a checkbox or radio item: true for selected and false for unselected. Only one radio item can be selected at a time in a given group of radio items. */
1962
- checked?: boolean | undefined;
1963
- /** Optional. The text to be displayed in the item; this is required unless type is 'separator'. When the context is 'selection', you can use %s within the string to show the selected text. For example, if this parameter's value is "Translate '%s' to Pig Latin" and the user selects the word "cool", the context menu item for the selection is "Translate 'cool' to Pig Latin". */
1964
- title?: string | undefined;
1965
- /** Optional. List of contexts this menu item will appear in. Defaults to ['page'] if not specified. */
1966
- contexts?: ContextType | ContextType[] | undefined;
1967
- /**
1968
- * Optional.
1969
- * @since Chrome 20
1970
- * Whether this context menu item is enabled or disabled. Defaults to true.
1971
- */
1972
- enabled?: boolean | undefined;
1973
- /** Optional. Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags. */
1974
- targetUrlPatterns?: string[] | undefined;
1975
- /**
1976
- * Optional.
1977
- * A function that will be called back when the menu item is clicked. Event pages cannot use this; instead, they should register a listener for chrome.contextMenus.onClicked.
1978
- * @param info Information sent when a context menu item is clicked.
1979
- * @param tab The details of the tab where the click took place. Note: this parameter only present for extensions.
1980
- */
1981
- onclick?: ((info: OnClickData, tab: chrome.tabs.Tab) => void) | undefined;
1982
- /** Optional. The ID of a parent menu item; this makes the item a child of a previously added item. */
1983
- parentId?: number | string | undefined;
1984
- /** Optional. The type of menu item. Defaults to 'normal' if not specified. */
1985
- type?: ContextItemType | undefined;
1986
- /**
1987
- * Optional.
1988
- * @since Chrome 21
1989
- * The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension.
1990
- */
1991
- id?: string | undefined;
1893
+ /** The initial state of a checkbox or radio button: `true` for selected, `false` for unselected. Only one radio button can be selected at a time in a given group. */
1894
+ checked?: boolean;
1895
+ /** List of contexts this menu item will appear in. Defaults to `['page']`. */
1896
+ contexts?: [`${ContextType}`, ...`${ContextType}`[]];
1897
+ /** Restricts the item to apply only to documents or frames whose URL matches one of the given patterns. For details on pattern formats, see Match Patterns. */
1898
+ documentUrlPatterns?: string[];
1899
+ /** Whether this context menu item is enabled or disabled. Defaults to `true`. */
1900
+ enabled?: boolean;
1901
+ /** The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension. */
1902
+ id?: string;
1903
+ /** The ID of a parent menu item; this makes the item a child of a previously added item. */
1904
+ parentId?: number | string;
1905
+ /** Similar to `documentUrlPatterns`, filters based on the `src` attribute of `img`, `audio`, and `video` tags and the `href` attribute of `a` tags. */
1906
+ targetUrlPatterns?: string[];
1907
+ /** The text to display in the item; this is _required_ unless `type` is `separator`. When the context is `selection`, use `%s` within the string to show the selected text. For example, if this parameter's value is "Translate '%s' to Pig Latin" and the user selects the word "cool", the context menu item for the selection is "Translate 'cool' to Pig Latin". */
1908
+ title?: string;
1909
+ /** The type of menu item. Defaults to `normal`. */
1910
+ type?: `${ItemType}`;
1911
+ /** Whether the item is visible in the menu. */
1912
+ visible?: boolean;
1992
1913
  /**
1993
- * Optional.
1994
- * @since Chrome 62
1995
- * Whether the item is visible in the menu.
1914
+ * A function that is called back when the menu item is clicked. This is not available inside of a service worker; instead, you should register a listener for {@link contextMenus.onClicked}.
1915
+ * @param info Information about the item clicked and the context where the click happened.
1916
+ * @param tab The details of the tab where the click took place. This parameter is not present for platform apps.
1996
1917
  */
1997
- visible?: boolean | undefined;
1918
+ onclick?: (
1919
+ info: OnClickData,
1920
+ tab: tabs.Tab,
1921
+ ) => void;
1998
1922
  }
1999
1923
 
2000
- export interface UpdateProperties extends Omit<CreateProperties, "id"> {}
2001
-
2002
- export interface MenuClickedEvent
2003
- extends chrome.events.Event<(info: OnClickData, tab?: chrome.tabs.Tab) => void>
2004
- {}
2005
-
2006
1924
  /**
2007
- * @since Chrome 38
2008
- * The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored.
1925
+ * The type of menu item.
1926
+ * @since Chrome 44
2009
1927
  */
2010
- export var ACTION_MENU_TOP_LEVEL_LIMIT: number;
1928
+ export enum ItemType {
1929
+ NORMAL = "normal",
1930
+ CHECKBOX = "checkbox",
1931
+ RADIO = "radio",
1932
+ SEPARATOR = "separator",
1933
+ }
1934
+
1935
+ /** Information sent when a context menu item is clicked. */
1936
+ export interface OnClickData {
1937
+ /** A flag indicating the state of a checkbox or radio item after it is clicked. */
1938
+ checked?: boolean;
1939
+ /** A flag indicating whether the element is editable (text input, textarea, etc.). */
1940
+ editable: boolean;
1941
+ /**
1942
+ * The ID of the frame of the element where the context menu was clicked, if it was in a frame.
1943
+ * @since Chrome 51
1944
+ */
1945
+ frameId?: number;
1946
+ /** The URL of the frame of the element where the context menu was clicked, if it was in a frame. */
1947
+ frameUrl?: string;
1948
+ /** If the element is a link, the URL it points to. */
1949
+ linkUrl?: string;
1950
+ /** One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements. */
1951
+ mediaType?: `${ContextType.IMAGE}` | `${ContextType.VIDEO}` | `${ContextType.AUDIO}`;
1952
+ /** The ID of the menu item that was clicked. */
1953
+ menuItemId: number | string;
1954
+ /** The URL of the page where the menu item was clicked. This property is not set if the click occurred in a context where there is no current page, such as in a launcher context menu. */
1955
+ pageUrl?: string;
1956
+ /** The parent ID, if any, for the item clicked.*/
1957
+ parentMenuItemId?: number | string;
1958
+ /** The text for the context selection, if any. */
1959
+ selectionText?: string | undefined;
1960
+ /** Will be present for elements with a 'src' URL. */
1961
+ srcUrl?: string | undefined;
1962
+ /** A flag indicating the state of a checkbox or radio item before it was clicked. */
1963
+ wasChecked?: boolean | undefined;
1964
+ }
1965
+
1966
+ /** The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored. */
1967
+ export const ACTION_MENU_TOP_LEVEL_LIMIT: 6;
2011
1968
 
2012
1969
  /**
2013
- * Removes all context menu items added by this extension.
2014
- * @since Chrome 123
2015
- */
2016
- export function removeAll(): Promise<void>;
2017
- /**
2018
- * Removes all context menu items added by this extension.
2019
- * @param callback Called when removal is complete.
2020
- */
2021
- export function removeAll(callback: () => void): void;
2022
- /**
2023
- * Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in chrome.runtime.lastError).
2024
- * @param callback Called when the item has been created in the browser. If there were any problems creating the item, details will be available in chrome.runtime.lastError.
1970
+ * Creates a new context menu item. If an error occurs during creation, it may not be detected until the creation callback fires; details will be in {@link chrome.runtime.lastError}.
2025
1971
  * @return The ID of the newly created item.
2026
1972
  */
2027
1973
  export function create(createProperties: CreateProperties, callback?: () => void): number | string;
2028
- /**
2029
- * Updates a previously created context menu item.
2030
- * @param id The ID of the item to update.
2031
- * @param updateProperties The properties to update. Accepts the same values as the create function.
2032
- * @since Chrome 123
2033
- */
2034
- export function update(id: string | number, updateProperties: UpdateProperties): Promise<void>;
2035
- /**
2036
- * Updates a previously created context menu item.
2037
- * @param id The ID of the item to update.
2038
- * @param updateProperties The properties to update. Accepts the same values as the create function.
2039
- * @param callback Called when the context menu has been updated.
2040
- */
2041
- export function update(id: string | number, updateProperties: UpdateProperties, callback: () => void): void;
1974
+
2042
1975
  /**
2043
1976
  * Removes a context menu item.
2044
1977
  * @param menuItemId The ID of the context menu item to remove.
2045
- * @since Chrome 123
1978
+ *
1979
+ * Can return its result via Promise since Chrome 123.
2046
1980
  */
2047
1981
  export function remove(menuItemId: string | number): Promise<void>;
1982
+ export function remove(menuItemId: string | number, callback: () => void): void;
1983
+
2048
1984
  /**
2049
- * Removes a context menu item.
2050
- * @param menuItemId The ID of the context menu item to remove.
2051
- * @param callback Called when the context menu has been removed.
1985
+ * Removes all context menu items added by this extension.
1986
+ *
1987
+ * Can return its result via Promise since Chrome 123.
2052
1988
  */
2053
- export function remove(menuItemId: string | number, callback: () => void): void;
1989
+ export function removeAll(): Promise<void>;
1990
+ export function removeAll(callback: () => void): void;
2054
1991
 
2055
1992
  /**
2056
- * @since Chrome 21
2057
- * Fired when a context menu item is clicked.
1993
+ * Updates a previously created context menu item.
1994
+ * @param id The ID of the item to update.
1995
+ * @param updateProperties The properties to update. Accepts the same values as the {@link contextMenus.create} function.
1996
+ *
1997
+ * Can return its result via Promise since Chrome 123.
2058
1998
  */
2059
- export var onClicked: MenuClickedEvent;
1999
+ export function update(id: string | number, updateProperties: Omit<CreateProperties, "id">): Promise<void>;
2000
+ export function update(
2001
+ id: string | number,
2002
+ updateProperties: Omit<CreateProperties, "id">,
2003
+ callback: () => void,
2004
+ ): void;
2005
+
2006
+ /** Fired when a context menu item is clicked. */
2007
+ export const onClicked: events.Event<(info: OnClickData, tab?: tabs.Tab) => void>;
2060
2008
  }
2061
2009
 
2062
2010
  ////////////////////
@@ -9008,7 +8956,7 @@ declare namespace chrome {
9008
8956
  default_popup?: string | undefined;
9009
8957
  }
9010
8958
 
9011
- // Source: https://developer.chrome.com/docs/extensions/mv3/declare_permissions/
8959
+ /** Source: https://developer.chrome.com/docs/extensions/reference/permissions-list */
9012
8960
  export type ManifestPermissions =
9013
8961
  | "accessibilityFeatures.modify"
9014
8962
  | "accessibilityFeatures.read"
@@ -9065,11 +9013,11 @@ declare namespace chrome {
9065
9013
  | "privacy"
9066
9014
  | "processes"
9067
9015
  | "proxy"
9016
+ | "readingList"
9068
9017
  | "scripting"
9069
9018
  | "search"
9070
9019
  | "sessions"
9071
9020
  | "sidePanel"
9072
- | "signedInDevices"
9073
9021
  | "storage"
9074
9022
  | "system.cpu"
9075
9023
  | "system.display"
@@ -9092,6 +9040,23 @@ declare namespace chrome {
9092
9040
  | "webRequestBlocking"
9093
9041
  | "webRequestAuthProvider";
9094
9042
 
9043
+ /** Source : https://developer.chrome.com/docs/extensions/reference/api/permissions */
9044
+ export type ManifestOptionalPermissions = Exclude<
9045
+ ManifestPermissions,
9046
+ | "debugger"
9047
+ | "declarativeNetRequest"
9048
+ | "devtools"
9049
+ | "experimental"
9050
+ | "fontSettings"
9051
+ | "geolocation"
9052
+ | "proxy"
9053
+ | "tts"
9054
+ | "ttsEngine"
9055
+ | "unlimitedStorage"
9056
+ | "wallpaper"
9057
+ | "webAuthenticationProxy"
9058
+ >;
9059
+
9095
9060
  export interface SearchProvider {
9096
9061
  name?: string | undefined;
9097
9062
  keyword?: string | undefined;
@@ -9311,8 +9276,8 @@ declare namespace chrome {
9311
9276
  }
9312
9277
  | undefined;
9313
9278
  content_security_policy?: string | undefined;
9314
- optional_permissions?: string[] | undefined;
9315
- permissions?: string[] | undefined;
9279
+ optional_permissions?: ManifestOptionalPermissions[] | string[] | undefined;
9280
+ permissions?: ManifestPermissions[] | string[] | undefined;
9316
9281
  web_accessible_resources?: string[] | undefined;
9317
9282
  }
9318
9283
 
@@ -9347,7 +9312,7 @@ declare namespace chrome {
9347
9312
  sandbox?: string;
9348
9313
  };
9349
9314
  host_permissions?: string[] | undefined;
9350
- optional_permissions?: ManifestPermissions[] | undefined;
9315
+ optional_permissions?: ManifestOptionalPermissions[] | undefined;
9351
9316
  optional_host_permissions?: string[] | undefined;
9352
9317
  permissions?: ManifestPermissions[] | undefined;
9353
9318
  web_accessible_resources?: Array<{ resources: string[]; matches: string[] }> | undefined;
@@ -12419,133 +12384,143 @@ declare namespace chrome {
12419
12384
  // Text to Speech
12420
12385
  ////////////////////
12421
12386
  /**
12422
- * Use the `chrome.tts` API to play synthesized text-to-speech (TTS). See also the related ttsEngine API, which allows an extension to implement a speech engine.
12387
+ * Use the `chrome.tts` API to play synthesized text-to-speech (TTS). See also the related {@link ttsEngine} API, which allows an extension to implement a speech engine.
12423
12388
  *
12424
12389
  * Permissions: "tts"
12425
12390
  */
12426
12391
  export namespace tts {
12392
+ /** @since Chrome 54 */
12393
+ export enum EventType {
12394
+ START = "start",
12395
+ END = "end",
12396
+ WORD = "word",
12397
+ SENTENCE = "sentence",
12398
+ MARKER = "marker",
12399
+ INTERRUPTED = "interrupted",
12400
+ CANCELLED = "cancelled",
12401
+ ERROR = "error",
12402
+ PAUSE = "pause",
12403
+ RESUME = "resume",
12404
+ }
12405
+
12427
12406
  /** An event from the TTS engine to communicate the status of an utterance. */
12428
12407
  export interface TtsEvent {
12429
- /** Optional. The index of the current character in the utterance. */
12430
- charIndex?: number | undefined;
12431
- /** Optional. The error description, if the event type is 'error'. */
12432
- errorMessage?: string | undefined;
12408
+ /** The index of the current character in the utterance. For word events, the event fires at the end of one word and before the beginning of the next. The `charIndex` represents a point in the text at the beginning of the next word to be spoken. */
12409
+ charIndex?: number;
12410
+ /** The error description, if the event type is `error`. */
12411
+ errorMessage?: string;
12433
12412
  /**
12434
- * The length of the next part of the utterance.
12435
- * For example, in a word event, this is the length of the word which will be spoken next.
12436
- * It will be set to -1 if not set by the speech engine.
12413
+ * The length of the next part of the utterance. For example, in a `word` event, this is the length of the word which will be spoken next. It will be set to -1 if not set by the speech engine.
12414
+ * @since Chrome 74
12437
12415
  */
12438
- length?: number | undefined;
12416
+ length?: number;
12417
+ /** The type can be `start` as soon as speech has started, `word` when a word boundary is reached, `sentence` when a sentence boundary is reached, `marker` when an SSML mark element is reached, `end` when the end of the utterance is reached, `interrupted` when the utterance is stopped or interrupted before reaching the end, `cancelled` when it's removed from the queue before ever being synthesized, or `error` when any other error occurs. When pausing speech, a `pause` event is fired if a particular utterance is paused in the middle, and `resume` if an utterance resumes speech. Note that pause and resume events may not fire if speech is paused in-between utterances. */
12418
+ type: `${EventType}`;
12419
+ }
12420
+
12421
+ /**
12422
+ * The speech options for the TTS engine.
12423
+ * @since Chrome 77
12424
+ */
12425
+ export interface TtsOptions {
12426
+ /** The TTS event types that you are interested in listening to. If missing, all event types may be sent. */
12427
+ desiredEventTypes?: string[];
12428
+ /** If true, enqueues this utterance if TTS is already in progress. If false (the default), interrupts any current speech and flushes the speech queue before speaking this new utterance. */
12429
+ enqueue?: boolean;
12430
+ /** The extension ID of the speech engine to use, if known. */
12431
+ extensionId?: string;
12439
12432
  /**
12440
- * The type can be 'start' as soon as speech has started, 'word' when a word boundary is reached, 'sentence' when a sentence boundary is reached, 'marker' when an SSML mark element is reached, 'end' when the end of the utterance is reached, 'interrupted' when the utterance is stopped or interrupted before reaching the end, 'cancelled' when it's removed from the queue before ever being synthesized, or 'error' when any other error occurs. When pausing speech, a 'pause' event is fired if a particular utterance is paused in the middle, and 'resume' if an utterance resumes speech. Note that pause and resume events may not fire if speech is paused in-between utterances.
12441
- * One of: "start", "end", "word", "sentence", "marker", "interrupted", "cancelled", "error", "pause", or "resume"
12433
+ * Gender of voice for synthesized speech.
12434
+ * @deprecated since Chrome 77. Gender is deprecated and will be ignored.
12442
12435
  */
12443
- type:
12444
- | "start"
12445
- | "end"
12446
- | "word"
12447
- | "sentence"
12448
- | "marker"
12449
- | "interrupted"
12450
- | "cancelled"
12451
- | "error"
12452
- | "pause"
12453
- | "resume";
12436
+ gender?: `${VoiceGender}`;
12437
+ /** The language to be used for synthesis, in the form _language_\-_region_. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */
12438
+ lang?: string;
12439
+ /** Speaking pitch between 0 and 2 inclusive, with 0 being lowest and 2 being highest. 1.0 corresponds to a voice's default pitch. */
12440
+ pitch?: number;
12441
+ /** Speaking rate relative to the default rate for this voice. 1.0 is the default rate, normally around 180 to 220 words per minute. 2.0 is twice as fast, and 0.5 is half as fast. Values below 0.1 or above 10.0 are strictly disallowed, but many voices will constrain the minimum and maximum rates further—for example a particular voice may not actually speak faster than 3 times normal even if you specify a value larger than 3.0. */
12442
+ rate?: number;
12443
+ /** The TTS event types the voice must support. */
12444
+ requiredEventTypes?: string[];
12445
+ /** The name of the voice to use for synthesis. If empty, uses any available voice. */
12446
+ voiceName?: string;
12447
+ /** Speaking volume between 0 and 1 inclusive, with 0 being lowest and 1 being highest, with a default of 1.0. */
12448
+ volume?: number;
12449
+ /**
12450
+ * This function is called with events that occur in the process of speaking the utterance.
12451
+ * @param event The update event from the text-to-speech engine indicating the status of this utterance.
12452
+ */
12453
+ onEvent?: (
12454
+ event: TtsEvent,
12455
+ ) => void;
12454
12456
  }
12455
12457
 
12456
12458
  /** A description of a voice available for speech synthesis. */
12457
12459
  export interface TtsVoice {
12458
- /** Optional. The language that this voice supports, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */
12459
- lang?: string | undefined;
12460
+ /** All of the callback event types that this voice is capable of sending. */
12461
+ eventTypes?: `${EventType}`[];
12462
+ /** The ID of the extension providing this voice. */
12463
+ extensionId?: string;
12460
12464
  /**
12461
- * Optional. This voice's gender.
12462
- * One of: "male", or "female"
12465
+ * This voice's gender.
12463
12466
  * @deprecated since Chrome 70. Gender is deprecated and will be ignored.
12464
12467
  */
12465
- gender?: string | undefined;
12466
- /** Optional. The name of the voice. */
12467
- voiceName?: string | undefined;
12468
- /** Optional. The ID of the extension providing this voice. */
12469
- extensionId?: string | undefined;
12470
- /** Optional. All of the callback event types that this voice is capable of sending. */
12471
- eventTypes?: string[] | undefined;
12472
- /**
12473
- * Optional. If true, the synthesis engine is a remote network resource. It may be higher latency and may incur bandwidth costs.
12474
- * @since Chrome 33
12475
- */
12476
- remote?: boolean | undefined;
12468
+ gender?: `${VoiceGender}`;
12469
+ /** The language that this voice supports, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */
12470
+ lang?: string;
12471
+ /** If true, the synthesis engine is a remote network resource. It may be higher latency and may incur bandwidth costs. */
12472
+ remote?: boolean;
12473
+ /** The name of the voice. */
12474
+ voiceName?: string;
12477
12475
  }
12478
12476
 
12479
- export interface SpeakOptions {
12480
- /** Optional. Speaking volume between 0 and 1 inclusive, with 0 being lowest and 1 being highest, with a default of 1.0. */
12481
- volume?: number | undefined;
12482
- /**
12483
- * Optional.
12484
- * If true, enqueues this utterance if TTS is already in progress. If false (the default), interrupts any current speech and flushes the speech queue before speaking this new utterance.
12485
- */
12486
- enqueue?: boolean | undefined;
12487
- /**
12488
- * Optional.
12489
- * Speaking rate relative to the default rate for this voice. 1.0 is the default rate, normally around 180 to 220 words per minute. 2.0 is twice as fast, and 0.5 is half as fast. Values below 0.1 or above 10.0 are strictly disallowed, but many voices will constrain the minimum and maximum rates further—for example a particular voice may not actually speak faster than 3 times normal even if you specify a value larger than 3.0.
12490
- */
12491
- rate?: number | undefined;
12492
- /**
12493
- * Optional. This function is called with events that occur in the process of speaking the utterance.
12494
- * @param event The update event from the text-to-speech engine indicating the status of this utterance.
12495
- */
12496
- onEvent?: ((event: TtsEvent) => void) | undefined;
12497
- /**
12498
- * Optional.
12499
- * Speaking pitch between 0 and 2 inclusive, with 0 being lowest and 2 being highest. 1.0 corresponds to a voice's default pitch.
12500
- */
12501
- pitch?: number | undefined;
12502
- /** Optional. The language to be used for synthesis, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */
12503
- lang?: string | undefined;
12504
- /** Optional. The name of the voice to use for synthesis. If empty, uses any available voice. */
12505
- voiceName?: string | undefined;
12506
- /** Optional. The extension ID of the speech engine to use, if known. */
12507
- extensionId?: string | undefined;
12508
- /**
12509
- * Optional. Gender of voice for synthesized speech.
12510
- * One of: "male", or "female"
12511
- */
12512
- gender?: string | undefined;
12513
- /** Optional. The TTS event types the voice must support. */
12514
- requiredEventTypes?: string[] | undefined;
12515
- /** Optional. The TTS event types that you are interested in listening to. If missing, all event types may be sent. */
12516
- desiredEventTypes?: string[] | undefined;
12477
+ /** @deprecated since Chrome 70. Gender is deprecated and is ignored.*/
12478
+ export enum VoiceGender {
12479
+ FEMALE = "female",
12480
+ MALE = "male",
12517
12481
  }
12518
12482
 
12519
- /** Checks whether the engine is currently speaking. On Mac OS X, the result is true whenever the system speech engine is speaking, even if the speech wasn't initiated by Chrome. */
12520
- export function isSpeaking(callback?: (speaking: boolean) => void): void;
12521
- /** Stops any current speech and flushes the queue of any pending utterances. In addition, if speech was paused, it will now be un-paused for the next call to speak. */
12522
- export function stop(): void;
12523
- /** Gets an array of all available voices. */
12483
+ /**
12484
+ * Gets an array of all available voices.
12485
+ *
12486
+ * Can return its result via Promise since Chrome Chrome 101
12487
+ */
12524
12488
  export function getVoices(): Promise<TtsVoice[]>;
12525
- export function getVoices(callback?: (voices: TtsVoice[]) => void): void;
12489
+ export function getVoices(callback: (voices: TtsVoice[]) => void): void;
12490
+
12526
12491
  /**
12527
- * Speaks text using a text-to-speech engine.
12528
- * @param utterance The text to speak, either plain text or a complete, well-formed SSML document. Speech engines that do not support SSML will strip away the tags and speak the text. The maximum length of the text is 32,768 characters.
12529
- * @param callback Optional. Called right away, before speech finishes. Check chrome.runtime.lastError to make sure there were no errors. Use options.onEvent to get more detailed feedback.
12492
+ * Checks whether the engine is currently speaking. On Mac OS X, the result is true whenever the system speech engine is speaking, even if the speech wasn't initiated by Chrome.
12493
+ *
12494
+ * Can return its result via Promise since Chrome Chrome 101
12530
12495
  */
12531
- export function speak(utterance: string, callback?: Function): void;
12496
+ export function isSpeaking(): Promise<boolean>;
12497
+ export function isSpeaking(callback: (speaking: boolean) => void): void;
12498
+
12499
+ /** Pauses speech synthesis, potentially in the middle of an utterance. A call to resume or stop will un-pause speech. */
12500
+ export function pause(): void;
12501
+
12502
+ /** If speech was paused, resumes speaking where it left off. */
12503
+ export function resume(): void;
12504
+
12532
12505
  /**
12533
12506
  * Speaks text using a text-to-speech engine.
12534
12507
  * @param utterance The text to speak, either plain text or a complete, well-formed SSML document. Speech engines that do not support SSML will strip away the tags and speak the text. The maximum length of the text is 32,768 characters.
12535
12508
  * @param options Optional. The speech options.
12536
- * @param callback Optional. Called right away, before speech finishes. Check chrome.runtime.lastError to make sure there were no errors. Use options.onEvent to get more detailed feedback.
12537
- */
12538
- export function speak(utterance: string, options: SpeakOptions, callback?: Function): void;
12539
- /**
12540
- * Pauses speech synthesis, potentially in the middle of an utterance. A call to resume or stop will un-pause speech.
12541
- * @since Chrome 29
12509
+
12510
+ * Can return its result via Promise since Chrome Chrome 101
12542
12511
  */
12543
- export function pause(): void;
12512
+ export function speak(utterance: string, options?: TtsOptions): Promise<void>;
12513
+ export function speak(utterance: string, callback: () => void): void;
12514
+ export function speak(utterance: string, options: TtsOptions, callback: () => void): void;
12515
+
12516
+ /** Stops any current speech and flushes the queue of any pending utterances. In addition, if speech was paused, it will now be un-paused for the next call to speak. */
12517
+ export function stop(): void;
12518
+
12544
12519
  /**
12545
- * If speech was paused, resumes speaking where it left off.
12546
- * @since Chrome 29
12520
+ * Called when the list of {@link TtsVoice} that would be returned by getVoices has changed.
12521
+ * @since Chrome 124
12547
12522
  */
12548
- export function resume(): void;
12523
+ const onVoicesChanged: chrome.events.Event<() => void>;
12549
12524
  }
12550
12525
 
12551
12526
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.314",
3
+ "version": "0.0.316",
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": "cd87ff79ab6fb076b0b2e8839b31df316142c4aaca471d2ed0e66244ec612054",
97
+ "typesPublisherContentHash": "ef2848ec857a2961c7b3f4fac265c8c66f7f87ed4ee074e89fa66558db476a76",
98
98
  "typeScriptVersion": "5.1"
99
99
  }