@types/chrome 0.0.321 → 0.0.323

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 +143 -143
  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, 09 May 2025 14:02:26 GMT
11
+ * Last updated: Fri, 16 May 2025 23:33:24 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
@@ -2,6 +2,9 @@
2
2
  /// <reference path="./har-format/index.d.ts" />
3
3
  /// <reference path="./chrome-cast/index.d.ts" />
4
4
 
5
+ // Helpers
6
+ type SetRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
7
+
5
8
  ////////////////////
6
9
  // Global object
7
10
  ////////////////////
@@ -2986,9 +2989,10 @@ declare namespace chrome {
2986
2989
  * Specifies the function to be called when the user clicks a resource link in the Developer Tools window. To unset the handler, either call the method with no parameters or pass null as the parameter.
2987
2990
  * @param callback A function that is called when the user clicks on a valid resource link in Developer Tools window. Note that if the user clicks an invalid URL or an XHR, this function is not called.
2988
2991
  * Parameter resource: A devtools.inspectedWindow.Resource object for the resource that was clicked.
2992
+ * Parameter lineNumber: Specifies the line number within the resource that was clicked.
2989
2993
  */
2990
2994
  export function setOpenResourceHandler(
2991
- callback?: (resource: chrome.devtools.inspectedWindow.Resource) => void,
2995
+ callback?: (resource: chrome.devtools.inspectedWindow.Resource, lineNumber: number) => void,
2992
2996
  ): void;
2993
2997
  /**
2994
2998
  * @since Chrome 38
@@ -7018,181 +7022,177 @@ declare namespace chrome {
7018
7022
  * Permissions: "notifications"
7019
7023
  */
7020
7024
  export namespace notifications {
7021
- export type TemplateType = "basic" | "image" | "list" | "progress";
7022
-
7023
- export interface ButtonOptions {
7025
+ export interface NotificationButton {
7026
+ /** @deprecated since Chrome 59. Button icons not visible for Mac OS X users. */
7027
+ iconUrl?: string;
7024
7028
  title: string;
7025
- iconUrl?: string | undefined;
7026
7029
  }
7027
7030
 
7028
- export interface ItemOptions {
7029
- /** Title of one item of a list notification. */
7030
- title: string;
7031
+ export interface NotificationItem {
7031
7032
  /** Additional details about this item. */
7032
7033
  message: string;
7034
+ /** Title of one item of a list notification. */
7035
+ title: string;
7033
7036
  }
7034
7037
 
7035
- export type NotificationOptions<T extends boolean = false> =
7036
- & {
7037
- /**
7038
- * Optional.
7039
- * Alternate notification content with a lower-weight font.
7040
- * @since Chrome 31
7041
- */
7042
- contextMessage?: string | undefined;
7043
- /** Optional. Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. */
7044
- priority?: number | undefined;
7045
- /** Optional. A timestamp associated with the notification, in milliseconds past the epoch (e.g. Date.now() + n). */
7046
- eventTime?: number | undefined;
7047
- /** Optional. Text and icons for up to two notification action buttons. */
7048
- buttons?: ButtonOptions[] | undefined;
7049
- /** Optional. Items for multi-item notifications. */
7050
- items?: ItemOptions[] | undefined;
7051
- /**
7052
- * Optional.
7053
- * Current progress ranges from 0 to 100.
7054
- * @since Chrome 30
7055
- */
7056
- progress?: number | undefined;
7057
- /**
7058
- * Optional.
7059
- * Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification.
7060
- * @since Chrome 32
7061
- */
7062
- isClickable?: boolean | undefined;
7063
- /**
7064
- * Optional.
7065
- * A URL to the app icon mask. URLs have the same restrictions as iconUrl. The app icon mask should be in alpha channel, as only the alpha channel of the image will be considered.
7066
- * @since Chrome 38
7067
- */
7068
- appIconMaskUrl?: string | undefined;
7069
- /** Optional. A URL to the image thumbnail for image-type notifications. URLs have the same restrictions as iconUrl. */
7070
- imageUrl?: string | undefined;
7071
- /**
7072
- * Indicates that the notification should remain visible on screen until the user activates or dismisses the notification.
7073
- * This defaults to false.
7074
- * @since Chrome 50
7075
- */
7076
- requireInteraction?: boolean | undefined;
7077
- /**
7078
- * Optional.
7079
- * Indicates that no sounds or vibrations should be made when the notification is being shown. This defaults to false.
7080
- * @since Chrome 70
7081
- */
7082
- silent?: boolean | undefined;
7083
- }
7084
- & (T extends true ? {
7085
- /**
7086
- * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
7087
- * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file. Required for notifications.create method.
7088
- */
7089
- iconUrl: string;
7090
- /** Main notification content. Required for notifications.create method. */
7091
- message: string;
7092
- /** Which type of notification to display. Required for notifications.create method. */
7093
- type: TemplateType;
7094
- /** Title of the notification (e.g. sender name for email). Required for notifications.create method. */
7095
- title: string;
7096
- }
7097
- : {
7098
- /**
7099
- * Optional.
7100
- * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
7101
- * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file. Required for notifications.create method.
7102
- */
7103
- iconUrl?: string | undefined;
7104
- /** Optional. Main notification content. Required for notifications.create method. */
7105
- message?: string | undefined;
7106
- /** Optional. Which type of notification to display. Required for notifications.create method. */
7107
- type?: TemplateType | undefined;
7108
- /** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */
7109
- title?: string | undefined;
7110
- });
7111
-
7112
- export interface NotificationClosedEvent
7113
- extends chrome.events.Event<(notificationId: string, byUser: boolean) => void>
7114
- {}
7115
-
7116
- export interface NotificationClickedEvent extends chrome.events.Event<(notificationId: string) => void> {}
7038
+ export interface NotificationOptions {
7039
+ /**
7040
+ * A URL to the app icon mask. URLs have the same restrictions as {@link notifications.NotificationOptions.iconUrl iconUrl}.
7041
+ *
7042
+ * The app icon mask should be in alpha channel, as only the alpha channel of the image will be considered.
7043
+ * @deprecated since Chrome 59. The app icon mask is not visible for Mac OS X users.
7044
+ */
7045
+ appIconMaskUrl?: string;
7046
+ /** Text and icons for up to two notification action buttons. */
7047
+ buttons?: NotificationButton[];
7048
+ /** Alternate notification content with a lower-weight font. */
7049
+ contextMessage?: string;
7050
+ /** A timestamp associated with the notification, in milliseconds past the epoch (e.g. `Date.now() + n`). */
7051
+ eventTime?: number;
7052
+ /**
7053
+ * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
7054
+ *
7055
+ * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file
7056
+ *
7057
+ * **Note:** This value is required for the {@link notifications.create}() method.
7058
+ */
7059
+ iconUrl?: string;
7060
+ /**
7061
+ * A URL to the image thumbnail for image-type notifications. URLs have the same restrictions as {@link notifications.NotificationOptions.iconUrl iconUrl}.
7062
+ * @deprecated since Chrome 59. The image is not visible for Mac OS X users.
7063
+ */
7064
+ imageUrl?: string;
7065
+ /** @deprecated since Chrome 67. This UI hint is ignored as of Chrome 67 */
7066
+ isClickable?: boolean;
7067
+ /** Items for multi-item notifications. Users on Mac OS X only see the first item. */
7068
+ items?: NotificationItem[];
7069
+ /**
7070
+ * Main notification content.
7071
+ *
7072
+ * **Note:** This value is required for the {@link notifications.create}() method.
7073
+ */
7074
+ message?: string;
7075
+ /** Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. On platforms that don't support a notification center (Windows, Linux & Mac), -2 and -1 result in an error as notifications with those priorities will not be shown at all. */
7076
+ priority?: number;
7077
+ /** Current progress ranges from 0 to 100. */
7078
+ progress?: number;
7079
+ /**
7080
+ * Indicates that the notification should remain visible on screen until the user activates or dismisses the notification. This defaults to false.
7081
+ * @since Chrome 50
7082
+ */
7083
+ requireInteraction?: boolean;
7084
+ /**
7085
+ * Indicates that no sounds or vibrations should be made when the notification is being shown. This defaults to false.
7086
+ * @since Chrome 70
7087
+ */
7088
+ silent?: boolean;
7089
+ /**
7090
+ * Title of the notification (e.g. sender name for email).
7091
+ *
7092
+ * **Note:** This value is required for the {@link notifications.create}() method.
7093
+ */
7094
+ title?: string;
7095
+ /** Which type of notification to display.
7096
+ *
7097
+ * **Note:** This value is required for the {@link notifications.create}() method.
7098
+ */
7099
+ type?: `${TemplateType}`;
7100
+ }
7117
7101
 
7118
- export interface NotificationButtonClickedEvent
7119
- extends chrome.events.Event<(notificationId: string, buttonIndex: number) => void>
7120
- {}
7102
+ type NotificationCreateOptions = SetRequired<NotificationOptions, "type" | "title" | "message" | "iconUrl">;
7121
7103
 
7122
- export interface NotificationPermissionLevelChangedEvent extends chrome.events.Event<(level: string) => void> {}
7104
+ export enum PermissionLevel {
7105
+ /** Specifies that the user has elected to show notifications from the app or extension. This is the default at install time. */
7106
+ GRANTED = "granted",
7107
+ /** Specifies that the user has elected not to show notifications from the app or extension. */
7108
+ DENIED = "denied",
7109
+ }
7123
7110
 
7124
- export interface NotificationShowSettingsEvent extends chrome.events.Event<() => void> {}
7111
+ export enum TemplateType {
7112
+ /** Contains an icon, title, message, expandedMessage, and up to two buttons. */
7113
+ BASIC = "basic",
7114
+ /** Contains an icon, title, message, expandedMessage, image, and up to two buttons. */
7115
+ IMAGE = "image",
7116
+ /** Contains an icon, title, message, items, and up to two buttons. Users on Mac OS X only see the first item. */
7117
+ LIST = "list",
7118
+ /** Contains an icon, title, message, progress, and up to two buttons. */
7119
+ PROGRESS = "progress",
7120
+ }
7125
7121
 
7126
- /** The notification closed, either by the system or by user action. */
7127
- export var onClosed: NotificationClosedEvent;
7128
- /** The user clicked in a non-button area of the notification. */
7129
- export var onClicked: NotificationClickedEvent;
7130
- /** The user pressed a button in the notification. */
7131
- export var onButtonClicked: NotificationButtonClickedEvent;
7132
- /**
7133
- * The user changes the permission level.
7134
- * @since Chrome 32
7135
- */
7136
- export var onPermissionLevelChanged: NotificationPermissionLevelChangedEvent;
7137
7122
  /**
7138
- * The user clicked on a link for the app's notification settings.
7139
- * @since Chrome 32
7123
+ * Clears the specified notification.
7124
+ * @param notificationId The id of the notification to be cleared. This is returned by {@link notifications.create} method.
7125
+ *
7126
+ * Can return its result via Promise since Chrome 116
7140
7127
  */
7141
- export var onShowSettings: NotificationShowSettingsEvent;
7128
+ export function clear(notificationId: string): Promise<boolean>;
7129
+ export function clear(notificationId: string, callback: (wasCleared: boolean) => void): void;
7142
7130
 
7143
7131
  /**
7144
7132
  * Creates and displays a notification.
7145
- * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation.
7146
- * The notificationId parameter is required before Chrome 42.
7133
+ * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation. The identifier may not be longer than 500 characters.
7134
+ *
7135
+ * The `notificationId` parameter is required before Chrome 42.
7147
7136
  * @param options Contents of the notification.
7148
- * @param callback Returns the notification id (either supplied or generated) that represents the created notification.
7149
- * The callback is required before Chrome 42.
7137
+ *
7138
+ * Can return its result via Promise since Chrome 116
7150
7139
  */
7140
+ export function create(notificationId: string, options: NotificationCreateOptions): Promise<string>;
7141
+ export function create(options: NotificationCreateOptions): Promise<string>;
7151
7142
  export function create(
7152
7143
  notificationId: string,
7153
- options: NotificationOptions<true>,
7154
- callback?: (notificationId: string) => void,
7144
+ options: NotificationCreateOptions,
7145
+ callback: (notificationId: string) => void,
7155
7146
  ): void;
7147
+ export function create(options: NotificationCreateOptions, callback: (notificationId: string) => void): void;
7148
+
7156
7149
  /**
7157
- * Creates and displays a notification.
7158
- * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation.
7159
- * The notificationId parameter is required before Chrome 42.
7160
- * @param options Contents of the notification.
7161
- * @param callback Returns the notification id (either supplied or generated) that represents the created notification.
7162
- * The callback is required before Chrome 42.
7150
+ * Retrieves all the notifications of this app or extension.
7151
+ *
7152
+ * Can return its result via Promise since Chrome 116
7153
+ */
7154
+ export function getAll(): Promise<{ [key: string]: true }>;
7155
+ export function getAll(callback: (notifications: { [key: string]: true }) => void): void;
7156
+
7157
+ /**
7158
+ * Retrieves whether the user has enabled notifications from this app or extension.
7159
+ *
7160
+ * Can return its result via Promise since Chrome 116
7163
7161
  */
7164
- export function create(options: NotificationOptions<true>, callback?: (notificationId: string) => void): void;
7162
+ export function getPermissionLevel(): Promise<`${PermissionLevel}`>;
7163
+ export function getPermissionLevel(callback: (level: `${PermissionLevel}`) => void): void;
7164
+
7165
7165
  /**
7166
7166
  * Updates an existing notification.
7167
- * @param notificationId The id of the notification to be updated. This is returned by notifications.create method.
7167
+ * @param notificationId The id of the notification to be updated. This is returned by {@link notifications.create} method.
7168
7168
  * @param options Contents of the notification to update to.
7169
- * @param callback Called to indicate whether a matching notification existed.
7170
- * The callback is required before Chrome 42.
7169
+ *
7170
+ * Can return its result via Promise since Chrome 116
7171
7171
  */
7172
+ export function update(notificationId: string, options: NotificationOptions): Promise<boolean>;
7172
7173
  export function update(
7173
7174
  notificationId: string,
7174
7175
  options: NotificationOptions,
7175
- callback?: (wasUpdated: boolean) => void,
7176
+ callback: (wasUpdated: boolean) => void,
7176
7177
  ): void;
7178
+
7179
+ /** The user pressed a button in the notification. */
7180
+ export const onButtonClicked: events.Event<(notificationId: string, buttonIndex: number) => void>;
7181
+
7182
+ /** The user clicked in a non-button area of the notification. */
7183
+ export const onClicked: events.Event<(notificationId: string) => void>;
7184
+
7185
+ /** The notification closed, either by the system or by user action. */
7186
+ export const onClosed: events.Event<(notificationId: string, byUser: boolean) => void>;
7187
+
7188
+ /** The user changes the permission level. As of Chrome 47, only ChromeOS has UI that dispatches this event. */
7189
+ export const onPermissionLevelChanged: events.Event<(level: `${PermissionLevel}`) => void>;
7190
+
7177
7191
  /**
7178
- * Clears the specified notification.
7179
- * @param notificationId The id of the notification to be cleared. This is returned by notifications.create method.
7180
- * @param callback Called to indicate whether a matching notification existed.
7181
- * The callback is required before Chrome 42.
7182
- */
7183
- export function clear(notificationId: string, callback?: (wasCleared: boolean) => void): void;
7184
- /**
7185
- * Retrieves all the notifications.
7186
- * @since Chrome 29
7187
- * @param callback Returns the set of notification_ids currently in the system.
7188
- */
7189
- export function getAll(callback: (notifications: { [key: string]: true }) => void): void;
7190
- /**
7191
- * Retrieves whether the user has enabled notifications from this app or extension.
7192
- * @since Chrome 32
7193
- * @param callback Returns the current permission level.
7192
+ * The user clicked on a link for the app's notification settings. As of Chrome 47, only ChromeOS has UI that dispatches this event. As of Chrome 65, that UI has been removed from ChromeOS, too.
7193
+ * @deprecated since Chrome 65. Custom notification settings button is no longer supported.
7194
7194
  */
7195
- export function getPermissionLevel(callback: (level: string) => void): void;
7195
+ export const onShowSettings: events.Event<() => void>;
7196
7196
  }
7197
7197
 
7198
7198
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.321",
3
+ "version": "0.0.323",
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": "33d65645ce9ffaef274abbe355db02d4c5dcdaa8cae6dbb749c23fe8472eb113",
97
+ "typesPublisherContentHash": "074305d089f256f5db9ac97d229525e353e1da24eac729acc00f00f3cbd462e1",
98
98
  "typeScriptVersion": "5.1"
99
99
  }