@types/chrome 0.0.322 → 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 +141 -142
  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, 12 May 2025 12:44:33 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
  ////////////////////
@@ -7019,181 +7022,177 @@ declare namespace chrome {
7019
7022
  * Permissions: "notifications"
7020
7023
  */
7021
7024
  export namespace notifications {
7022
- export type TemplateType = "basic" | "image" | "list" | "progress";
7023
-
7024
- export interface ButtonOptions {
7025
+ export interface NotificationButton {
7026
+ /** @deprecated since Chrome 59. Button icons not visible for Mac OS X users. */
7027
+ iconUrl?: string;
7025
7028
  title: string;
7026
- iconUrl?: string | undefined;
7027
7029
  }
7028
7030
 
7029
- export interface ItemOptions {
7030
- /** Title of one item of a list notification. */
7031
- title: string;
7031
+ export interface NotificationItem {
7032
7032
  /** Additional details about this item. */
7033
7033
  message: string;
7034
+ /** Title of one item of a list notification. */
7035
+ title: string;
7034
7036
  }
7035
7037
 
7036
- export type NotificationOptions<T extends boolean = false> =
7037
- & {
7038
- /**
7039
- * Optional.
7040
- * Alternate notification content with a lower-weight font.
7041
- * @since Chrome 31
7042
- */
7043
- contextMessage?: string | undefined;
7044
- /** Optional. Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. */
7045
- priority?: number | undefined;
7046
- /** Optional. A timestamp associated with the notification, in milliseconds past the epoch (e.g. Date.now() + n). */
7047
- eventTime?: number | undefined;
7048
- /** Optional. Text and icons for up to two notification action buttons. */
7049
- buttons?: ButtonOptions[] | undefined;
7050
- /** Optional. Items for multi-item notifications. */
7051
- items?: ItemOptions[] | undefined;
7052
- /**
7053
- * Optional.
7054
- * Current progress ranges from 0 to 100.
7055
- * @since Chrome 30
7056
- */
7057
- progress?: number | undefined;
7058
- /**
7059
- * Optional.
7060
- * Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification.
7061
- * @since Chrome 32
7062
- */
7063
- isClickable?: boolean | undefined;
7064
- /**
7065
- * Optional.
7066
- * 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.
7067
- * @since Chrome 38
7068
- */
7069
- appIconMaskUrl?: string | undefined;
7070
- /** Optional. A URL to the image thumbnail for image-type notifications. URLs have the same restrictions as iconUrl. */
7071
- imageUrl?: string | undefined;
7072
- /**
7073
- * Indicates that the notification should remain visible on screen until the user activates or dismisses the notification.
7074
- * This defaults to false.
7075
- * @since Chrome 50
7076
- */
7077
- requireInteraction?: boolean | undefined;
7078
- /**
7079
- * Optional.
7080
- * Indicates that no sounds or vibrations should be made when the notification is being shown. This defaults to false.
7081
- * @since Chrome 70
7082
- */
7083
- silent?: boolean | undefined;
7084
- }
7085
- & (T extends true ? {
7086
- /**
7087
- * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
7088
- * 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.
7089
- */
7090
- iconUrl: string;
7091
- /** Main notification content. Required for notifications.create method. */
7092
- message: string;
7093
- /** Which type of notification to display. Required for notifications.create method. */
7094
- type: TemplateType;
7095
- /** Title of the notification (e.g. sender name for email). Required for notifications.create method. */
7096
- title: string;
7097
- }
7098
- : {
7099
- /**
7100
- * Optional.
7101
- * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
7102
- * 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.
7103
- */
7104
- iconUrl?: string | undefined;
7105
- /** Optional. Main notification content. Required for notifications.create method. */
7106
- message?: string | undefined;
7107
- /** Optional. Which type of notification to display. Required for notifications.create method. */
7108
- type?: TemplateType | undefined;
7109
- /** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */
7110
- title?: string | undefined;
7111
- });
7112
-
7113
- export interface NotificationClosedEvent
7114
- extends chrome.events.Event<(notificationId: string, byUser: boolean) => void>
7115
- {}
7116
-
7117
- 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
+ }
7118
7101
 
7119
- export interface NotificationButtonClickedEvent
7120
- extends chrome.events.Event<(notificationId: string, buttonIndex: number) => void>
7121
- {}
7102
+ type NotificationCreateOptions = SetRequired<NotificationOptions, "type" | "title" | "message" | "iconUrl">;
7122
7103
 
7123
- 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
+ }
7124
7110
 
7125
- 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
+ }
7126
7121
 
7127
- /** The notification closed, either by the system or by user action. */
7128
- export var onClosed: NotificationClosedEvent;
7129
- /** The user clicked in a non-button area of the notification. */
7130
- export var onClicked: NotificationClickedEvent;
7131
- /** The user pressed a button in the notification. */
7132
- export var onButtonClicked: NotificationButtonClickedEvent;
7133
- /**
7134
- * The user changes the permission level.
7135
- * @since Chrome 32
7136
- */
7137
- export var onPermissionLevelChanged: NotificationPermissionLevelChangedEvent;
7138
7122
  /**
7139
- * The user clicked on a link for the app's notification settings.
7140
- * @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
7141
7127
  */
7142
- export var onShowSettings: NotificationShowSettingsEvent;
7128
+ export function clear(notificationId: string): Promise<boolean>;
7129
+ export function clear(notificationId: string, callback: (wasCleared: boolean) => void): void;
7143
7130
 
7144
7131
  /**
7145
7132
  * Creates and displays a notification.
7146
- * @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.
7147
- * 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.
7148
7136
  * @param options Contents of the notification.
7149
- * @param callback Returns the notification id (either supplied or generated) that represents the created notification.
7150
- * The callback is required before Chrome 42.
7137
+ *
7138
+ * Can return its result via Promise since Chrome 116
7151
7139
  */
7140
+ export function create(notificationId: string, options: NotificationCreateOptions): Promise<string>;
7141
+ export function create(options: NotificationCreateOptions): Promise<string>;
7152
7142
  export function create(
7153
7143
  notificationId: string,
7154
- options: NotificationOptions<true>,
7155
- callback?: (notificationId: string) => void,
7144
+ options: NotificationCreateOptions,
7145
+ callback: (notificationId: string) => void,
7156
7146
  ): void;
7147
+ export function create(options: NotificationCreateOptions, callback: (notificationId: string) => void): void;
7148
+
7157
7149
  /**
7158
- * Creates and displays a notification.
7159
- * @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.
7160
- * The notificationId parameter is required before Chrome 42.
7161
- * @param options Contents of the notification.
7162
- * @param callback Returns the notification id (either supplied or generated) that represents the created notification.
7163
- * 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
7164
7161
  */
7165
- 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
+
7166
7165
  /**
7167
7166
  * Updates an existing notification.
7168
- * @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.
7169
7168
  * @param options Contents of the notification to update to.
7170
- * @param callback Called to indicate whether a matching notification existed.
7171
- * The callback is required before Chrome 42.
7169
+ *
7170
+ * Can return its result via Promise since Chrome 116
7172
7171
  */
7172
+ export function update(notificationId: string, options: NotificationOptions): Promise<boolean>;
7173
7173
  export function update(
7174
7174
  notificationId: string,
7175
7175
  options: NotificationOptions,
7176
- callback?: (wasUpdated: boolean) => void,
7176
+ callback: (wasUpdated: boolean) => void,
7177
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
+
7178
7191
  /**
7179
- * Clears the specified notification.
7180
- * @param notificationId The id of the notification to be cleared. This is returned by notifications.create method.
7181
- * @param callback Called to indicate whether a matching notification existed.
7182
- * The callback is required before Chrome 42.
7183
- */
7184
- export function clear(notificationId: string, callback?: (wasCleared: boolean) => void): void;
7185
- /**
7186
- * Retrieves all the notifications.
7187
- * @since Chrome 29
7188
- * @param callback Returns the set of notification_ids currently in the system.
7189
- */
7190
- export function getAll(callback: (notifications: { [key: string]: true }) => void): void;
7191
- /**
7192
- * Retrieves whether the user has enabled notifications from this app or extension.
7193
- * @since Chrome 32
7194
- * @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.
7195
7194
  */
7196
- export function getPermissionLevel(callback: (level: string) => void): void;
7195
+ export const onShowSettings: events.Event<() => void>;
7197
7196
  }
7198
7197
 
7199
7198
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.322",
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": "d2211cafb9d168b91482e87001e7cbfcd764551a4d73eac6e6f957699d0b7015",
97
+ "typesPublisherContentHash": "074305d089f256f5db9ac97d229525e353e1da24eac729acc00f00f3cbd462e1",
98
98
  "typeScriptVersion": "5.1"
99
99
  }