@types/chrome 0.1.19 → 0.1.20

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 +25 -19
  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: Thu, 02 Oct 2025 20:02:36 GMT
11
+ * Last updated: Fri, 03 Oct 2025 06:02:16 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
 
14
14
  # Credits
chrome/index.d.ts CHANGED
@@ -10720,11 +10720,8 @@ declare namespace chrome {
10720
10720
  export interface CaptureInfo {
10721
10721
  /** The id of the tab whose status changed. */
10722
10722
  tabId: number;
10723
- /**
10724
- * The new capture status of the tab.
10725
- * One of: "pending", "active", "stopped", or "error"
10726
- */
10727
- status: string;
10723
+ /** The new capture status of the tab. */
10724
+ status: `${TabCaptureState}`;
10728
10725
  /** Whether an element in the tab being captured is in fullscreen mode. */
10729
10726
  fullscreen: boolean;
10730
10727
  }
@@ -10735,46 +10732,55 @@ declare namespace chrome {
10735
10732
  }
10736
10733
 
10737
10734
  export interface CaptureOptions {
10738
- /** Optional. */
10739
10735
  audio?: boolean | undefined;
10740
- /** Optional. */
10741
10736
  video?: boolean | undefined;
10742
- /** Optional. */
10743
10737
  audioConstraints?: MediaStreamConstraint | undefined;
10744
- /** Optional. */
10745
10738
  videoConstraints?: MediaStreamConstraint | undefined;
10746
10739
  }
10747
10740
 
10741
+ /** @since Chrome 71 */
10748
10742
  export interface GetMediaStreamOptions {
10749
- /** Optional tab id of the tab which will later invoke getUserMedia() to consume the stream. If not specified then the resulting stream can be used only by the calling extension. The stream can only be used by frames in the given tab whose security origin matches the consumber tab's origin. The tab's origin must be a secure origin, e.g. HTTPS. */
10743
+ /** Optional tab id of the tab which will later invoke `getUserMedia()` to consume the stream. If not specified then the resulting stream can be used only by the calling extension. The stream can only be used by frames in the given tab whose security origin matches the consumber tab's origin. The tab's origin must be a secure origin, e.g. HTTPS. */
10750
10744
  consumerTabId?: number | undefined;
10751
- /** Optional tab id of the tab which will be captured. If not specified then the current active tab will be selected. Only tabs for which the extension has been granted the activeTab permission can be used as the target tab. */
10745
+ /** Optional tab id of the tab which will be captured. If not specified then the current active tab will be selected. Only tabs for which the extension has been granted the `activeTab` permission can be used as the target tab. */
10752
10746
  targetTabId?: number | undefined;
10753
10747
  }
10754
10748
 
10755
- export interface CaptureStatusChangedEvent extends chrome.events.Event<(info: CaptureInfo) => void> {}
10749
+ export enum TabCaptureState {
10750
+ PENDING = "pending",
10751
+ ACTIVE = "active",
10752
+ STOPPED = "stopped",
10753
+ ERROR = "error",
10754
+ }
10756
10755
 
10757
10756
  /**
10758
- * Captures the visible area of the currently active tab. Capture can only be started on the currently active tab after the extension has been invoked. Capture is maintained across page navigations within the tab, and stops when the tab is closed, or the media stream is closed by the extension.
10757
+ * Captures the visible area of the currently active tab. Capture can only be started on the currently active tab after the extension has been invoked, similar to the way that activeTab works. Capture is maintained across page navigations within the tab, and stops when the tab is closed, or the media stream is closed by the extension.
10759
10758
  * @param options Configures the returned media stream.
10760
- * @param callback Callback with either the tab capture stream or null.
10761
10759
  */
10762
10760
  export function capture(options: CaptureOptions, callback: (stream: MediaStream | null) => void): void;
10761
+
10763
10762
  /**
10764
10763
  * Returns a list of tabs that have requested capture or are being captured, i.e. status != stopped and status != error. This allows extensions to inform the user that there is an existing tab capture that would prevent a new tab capture from succeeding (or to prevent redundant requests for the same tab).
10765
- * @param callback Callback invoked with CaptureInfo[] for captured tabs.
10764
+ *
10765
+ * Can return its result via Promise in Manifest V3 or later since Chrome 116.
10766
10766
  */
10767
+ export function getCapturedTabs(): Promise<CaptureInfo[]>;
10767
10768
  export function getCapturedTabs(callback: (result: CaptureInfo[]) => void): void;
10768
10769
 
10769
10770
  /**
10770
10771
  * Creates a stream ID to capture the target tab. Similar to chrome.tabCapture.capture() method, but returns a media stream ID, instead of a media stream, to the consumer tab.
10771
- * @param options Options for the media stream id to retrieve.
10772
- * @param callback Callback to invoke with the result. If successful, the result is an opaque string that can be passed to the getUserMedia() API to generate a media stream that corresponds to the target tab. The created streamId can only be used once and expires after a few seconds if it is not used.
10772
+ *
10773
+ * Can return its result via Promise in Manifest V3 or later since Chrome 116.
10773
10774
  */
10774
- export function getMediaStreamId(options: GetMediaStreamOptions, callback: (streamId: string) => void): void;
10775
+ export function getMediaStreamId(options?: GetMediaStreamOptions): Promise<string>;
10776
+ export function getMediaStreamId(callback: (streamId: string) => void): void;
10777
+ export function getMediaStreamId(
10778
+ options: GetMediaStreamOptions | undefined,
10779
+ callback: (streamId: string) => void,
10780
+ ): void;
10775
10781
 
10776
10782
  /** Event fired when the capture status of a tab changes. This allows extension authors to keep track of the capture status of tabs to keep UI elements like page actions in sync. */
10777
- export var onStatusChanged: CaptureStatusChangedEvent;
10783
+ export const onStatusChanged: events.Event<(info: CaptureInfo) => void>;
10778
10784
  }
10779
10785
 
10780
10786
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
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": "a82926d5a4b7fddf359d40643638f66c3408efcef582bb042d95e2827cc75f8a",
97
+ "typesPublisherContentHash": "433cd27fa4711e2223cc598ccb6f0921c2fdadb29d28cee16f78c1f291cce217",
98
98
  "typeScriptVersion": "5.2"
99
99
  }