@types/chrome 0.1.20 → 0.1.22

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 +69 -48
  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, 03 Oct 2025 06:02:16 GMT
11
+ * Last updated: Fri, 03 Oct 2025 21:32:25 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
@@ -6900,22 +6900,38 @@ declare namespace chrome {
6900
6900
  * @since Chrome 78
6901
6901
  */
6902
6902
  export namespace loginState {
6903
- export interface SessionStateChangedEvent extends chrome.events.Event<(sessionState: SessionState) => void> {}
6904
-
6905
- /** Possible profile types. */
6906
- export type ProfileType = "SIGNIN_PROFILE" | "USER_PROFILE";
6903
+ export enum ProfileType {
6904
+ SIGNIN_PROFILE = "SIGNIN_PROFILE",
6905
+ USER_PROFILE = "USER_PROFILE",
6906
+ }
6907
6907
 
6908
- /** Possible session states. */
6909
- export type SessionState = "UNKNOWN" | "IN_OOBE_SCREEN" | "IN_LOGIN_SCREEN" | "IN_SESSION" | "IN_LOCK_SCREEN";
6908
+ export enum SessionState {
6909
+ UNKNOWN = "UNKNOWN",
6910
+ IN_OOBE_SCREEN = "IN_OOBE_SCREEN",
6911
+ IN_LOGIN_SCREEN = "IN_LOGIN_SCREEN",
6912
+ IN_SESSION = "IN_SESSION",
6913
+ IN_LOCK_SCREEN = "IN_LOCK_SCREEN",
6914
+ IN_RMA_SCREEN = "IN_RMA_SCREEN",
6915
+ }
6910
6916
 
6911
- /** Gets the type of the profile the extension is in. */
6912
- export function getProfileType(callback: (profileType: ProfileType) => void): void;
6917
+ /**
6918
+ * Gets the type of the profile the extension is in.
6919
+ *
6920
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
6921
+ */
6922
+ export function getProfileType(): Promise<`${ProfileType}`>;
6923
+ export function getProfileType(callback: (result: `${ProfileType}`) => void): void;
6913
6924
 
6914
- /** Gets the current session state. */
6915
- export function getSessionState(callback: (sessionState: SessionState) => void): void;
6925
+ /**
6926
+ * Gets the current session state.
6927
+ *
6928
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
6929
+ */
6930
+ export function getSessionState(): Promise<`${SessionState}`>;
6931
+ export function getSessionState(callback: (sessionState: `${SessionState}`) => void): void;
6916
6932
 
6917
- /** Dispatched when the session state changes. sessionState is the new session state.*/
6918
- export const onSessionStateChanged: SessionStateChangedEvent;
6933
+ /** Dispatched when the session state changes. `sessionState` is the new session state.*/
6934
+ export const onSessionStateChanged: events.Event<(sessionState: `${SessionState}`) => void>;
6919
6935
  }
6920
6936
 
6921
6937
  ////////////////////
@@ -10140,69 +10156,74 @@ declare namespace chrome {
10140
10156
  * Permissions: "system.storage"
10141
10157
  */
10142
10158
  export namespace system.storage {
10159
+ export enum EjectDeviceResultCode {
10160
+ /** The ejection command is successful -- the application can prompt the user to remove the device. */
10161
+ SUCCESS = "success",
10162
+ /** The device is in use by another application. The ejection did not succeed; the user should not remove the device until the other application is done with the device. */
10163
+ IN_USE = "in_use",
10164
+ /** There is no such device known. */
10165
+ NO_SUCH_DEVICE = "no_such_device",
10166
+ /** The ejection command failed. */
10167
+ FAILURE = "failure",
10168
+ }
10169
+
10143
10170
  export interface StorageUnitInfo {
10144
10171
  /** The transient ID that uniquely identifies the storage device. This ID will be persistent within the same run of a single application. It will not be a persistent identifier between different runs of an application, or between different applications. */
10145
10172
  id: string;
10146
10173
  /** The name of the storage unit. */
10147
10174
  name: string;
10148
- /**
10149
- * The media type of the storage unit.
10150
- * fixed: The storage has fixed media, e.g. hard disk or SSD.
10151
- * removable: The storage is removable, e.g. USB flash drive.
10152
- * unknown: The storage type is unknown.
10153
- */
10154
- type: string;
10175
+ /** The media type of the storage unit. */
10176
+ type: `${StorageUnitType}`;
10155
10177
  /** The total amount of the storage space, in bytes. */
10156
10178
  capacity: number;
10157
10179
  }
10158
10180
 
10159
- export interface StorageCapacityInfo {
10160
- /** A copied |id| of getAvailableCapacity function parameter |id|. */
10181
+ export enum StorageUnitType {
10182
+ /** The storage has fixed media, e.g. hard disk or SSD. */
10183
+ FIXED = "fixed",
10184
+ /** The storage is removable, e.g. USB flash drive. */
10185
+ REMOVABLE = "removable",
10186
+ /** The storage type is unknown. */
10187
+ UNKNOWN = "unknown",
10188
+ }
10189
+
10190
+ export interface StorageAvailableCapacityInfo {
10191
+ /** A copied `id` of getAvailableCapacity function parameter `id`. */
10161
10192
  id: string;
10162
10193
  /** The available capacity of the storage device, in bytes. */
10163
10194
  availableCapacity: number;
10164
10195
  }
10165
10196
 
10166
- export interface SystemStorageAttachedEvent extends chrome.events.Event<(info: StorageUnitInfo) => void> {}
10167
-
10168
- export interface SystemStorageDetachedEvent extends chrome.events.Event<(id: string) => void> {}
10169
-
10170
- /** Get the storage information from the system. The argument passed to the callback is an array of StorageUnitInfo objects. */
10171
- export function getInfo(callback: (info: StorageUnitInfo[]) => void): void;
10172
10197
  /**
10173
10198
  * Get the storage information from the system. The argument passed to the callback is an array of StorageUnitInfo objects.
10174
- * @return The `getInfo` method provides its result via callback or returned as a `Promise` (MV3 only).
10199
+ *
10200
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
10175
10201
  */
10176
10202
  export function getInfo(): Promise<StorageUnitInfo[]>;
10203
+ export function getInfo(callback: (info: StorageUnitInfo[]) => void): void;
10204
+
10177
10205
  /**
10178
10206
  * Ejects a removable storage device.
10179
- * @param callback
10180
- * Parameter result: success: The ejection command is successful -- the application can prompt the user to remove the device; in_use: The device is in use by another application. The ejection did not succeed; the user should not remove the device until the other application is done with the device; no_such_device: There is no such device known. failure: The ejection command failed.
10181
- */
10182
- export function ejectDevice(id: string, callback: (result: string) => void): void;
10183
- /**
10184
- * Ejects a removable storage device.
10185
- * @param callback
10186
- * Parameter result: success: The ejection command is successful -- the application can prompt the user to remove the device; in_use: The device is in use by another application. The ejection did not succeed; the user should not remove the device until the other application is done with the device; no_such_device: There is no such device known. failure: The ejection command failed.
10187
- * @return The `ejectDevice` method provides its result via callback or returned as a `Promise` (MV3 only).
10188
- */
10189
- export function ejectDevice(id: string): Promise<string>;
10190
- /**
10191
- * Get the available capacity of a specified |id| storage device. The |id| is the transient device ID from StorageUnitInfo.
10192
- * @since Dev channel only.
10207
+ *
10208
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
10193
10209
  */
10194
- export function getAvailableCapacity(id: string, callback: (info: StorageCapacityInfo) => void): void;
10210
+ export function ejectDevice(id: string): Promise<`${EjectDeviceResultCode}`>;
10211
+ export function ejectDevice(id: string, callback: (result: `${EjectDeviceResultCode}`) => void): void;
10212
+
10195
10213
  /**
10196
- * Get the available capacity of a specified |id| storage device. The |id| is the transient device ID from StorageUnitInfo.
10214
+ * Get the available capacity of a specified `id` storage device. The `id` is the transient device ID from StorageUnitInfo.
10215
+ *
10216
+ * Can return its result via Promise in Manifest V3.
10197
10217
  * @since Dev channel only.
10198
- * @return The `getAvailableCapacity` method provides its result via callback or returned as a `Promise` (MV3 only).
10199
10218
  */
10200
- export function getAvailableCapacity(id: string): Promise<StorageCapacityInfo>;
10219
+ export function getAvailableCapacity(id: string): Promise<StorageAvailableCapacityInfo>;
10220
+ export function getAvailableCapacity(id: string, callback: (info: StorageAvailableCapacityInfo) => void): void;
10201
10221
 
10202
10222
  /** Fired when a new removable storage is attached to the system. */
10203
- export var onAttached: SystemStorageAttachedEvent;
10223
+ export const onAttached: events.Event<(info: StorageUnitInfo) => void>;
10224
+
10204
10225
  /** Fired when a removable storage is detached from the system. */
10205
- export var onDetached: SystemStorageDetachedEvent;
10226
+ export const onDetached: events.Event<(id: string) => void>;
10206
10227
  }
10207
10228
 
10208
10229
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
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": "433cd27fa4711e2223cc598ccb6f0921c2fdadb29d28cee16f78c1f291cce217",
97
+ "typesPublisherContentHash": "eada04150c1c42679c4730cf050e1fb35c08aeda9efc7f58416c976c363236bb",
98
98
  "typeScriptVersion": "5.2"
99
99
  }