@types/chrome 0.0.261 → 0.0.262

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +166 -0
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (http://developer.chrome.com/e
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, 22 Feb 2024 23:35:22 GMT
11
+ * Last updated: Mon, 26 Feb 2024 21:10:43 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
@@ -7349,6 +7349,7 @@ declare namespace chrome.runtime {
7349
7349
  | "tts"
7350
7350
  | "ttsEngine"
7351
7351
  | "unlimitedStorage"
7352
+ | "userScripts"
7352
7353
  | "vpnProvider"
7353
7354
  | "wallpaper"
7354
7355
  | "webNavigation"
@@ -7881,6 +7882,20 @@ declare namespace chrome.runtime {
7881
7882
  * Fired when a Chrome update is available, but isn't installed immediately because a browser restart is required.
7882
7883
  */
7883
7884
  export var onBrowserUpdateAvailable: RuntimeEvent;
7885
+
7886
+ /**
7887
+ * @since chrome 115+
7888
+ * @requires MV3+
7889
+ * Listens for connections made from user scripts associated with this extension.
7890
+ */
7891
+ export var onUserScriptConnect: ExtensionConnectEvent;
7892
+
7893
+ /**
7894
+ * @since chrome 115+
7895
+ * @requires MV3+
7896
+ * Listens for messages sent from user scripts associated with this extension.
7897
+ */
7898
+ export var onUserScriptMessage: ExtensionMessageEvent;
7884
7899
  }
7885
7900
 
7886
7901
  ////////////////////
@@ -12948,3 +12963,154 @@ declare namespace chrome.sidePanel {
12948
12963
  behavior: PanelBehavior,
12949
12964
  ): Promise<void>;
12950
12965
  }
12966
+
12967
+ // Type definitions for chrome.userScripts API
12968
+
12969
+ /**
12970
+ * Availability: Chrome 120 beta. Manifest v3.
12971
+ * https://developer.chrome.com/docs/extensions/reference/api/userScripts
12972
+ * Permissions: "userScripts"
12973
+ * Description: "A user script is a bit of code injected into a web page to modify its appearance or behavior. Scripts are either created by users or downloaded from a script repository or a user script extension.""
12974
+ */
12975
+
12976
+ declare namespace chrome.userScripts {
12977
+ /**
12978
+ * Execution environment for a user script.
12979
+ */
12980
+ export type ExecutionWorld = "MAIN" | "USER_SCRIPT";
12981
+
12982
+ /**
12983
+ * Properties for configuring the user script world.
12984
+ */
12985
+ export interface WorldProperties {
12986
+ /** Specifies the world csp. The default is the `ISOLATED` world csp. */
12987
+ csp?: string;
12988
+ /** Specifies whether messaging APIs are exposed. The default is false.*/
12989
+ messaging?: boolean;
12990
+ }
12991
+
12992
+ /**
12993
+ * Properties for filtering user scripts.
12994
+ */
12995
+ export interface UserScriptFilter {
12996
+ ids?: string[];
12997
+ }
12998
+
12999
+ /**
13000
+ * Properties for a registered user script.
13001
+ */
13002
+ export interface RegisteredUserScript {
13003
+ /** If true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched. */
13004
+ allFrames?: boolean;
13005
+ /** Specifies wildcard patterns for pages this user script will NOT be injected into. */
13006
+ excludeGlobs?: string[];
13007
+ /**Excludes pages that this user script would otherwise be injected into. See Match Patterns for more details on the syntax of these strings. */
13008
+ excludeMatches?: string[];
13009
+ /** The ID of the user script specified in the API call. This property must not start with a '_' as it's reserved as a prefix for generated script IDs. */
13010
+ id: string;
13011
+ /** Specifies wildcard patterns for pages this user script will be injected into. */
13012
+ includeGlobs?: string[];
13013
+ /** The list of ScriptSource objects defining sources of scripts to be injected into matching pages. */
13014
+ js: ScriptSource[];
13015
+ /** Specifies which pages this user script will be injected into. See Match Patterns for more details on the syntax of these strings. This property must be specified for ${ref:register}. */
13016
+ matches?: string[];
13017
+ /** Specifies when JavaScript files are injected into the web page. The preferred and default value is document_idle */
13018
+ runAt?: RunAt;
13019
+ /** The JavaScript execution environment to run the script in. The default is `USER_SCRIPT` */
13020
+ world?: ExecutionWorld;
13021
+ }
13022
+
13023
+ /**
13024
+ * Properties for a script source.
13025
+ */
13026
+ export interface ScriptSource {
13027
+ /** A string containing the JavaScript code to inject. Exactly one of file or code must be specified. */
13028
+ code?: string;
13029
+ /** The path of the JavaScript file to inject relative to the extension's root directory. Exactly one of file or code must be specified. */
13030
+ file?: string;
13031
+ }
13032
+
13033
+ /**
13034
+ * Enum for the run-at property.
13035
+ */
13036
+ export type RunAt = "document_start" | "document_end" | "document_idle";
13037
+
13038
+ /**
13039
+ * Configures the `USER_SCRIPT` execution environment.
13040
+ *
13041
+ * @param properties - Contains the user script world configuration.
13042
+ * @returns A Promise that resolves with the same type that is passed to the callback.
13043
+ */
13044
+ export function configureWorld(properties: WorldProperties): Promise<void>;
13045
+ /**
13046
+ * Configures the `USER_SCRIPT` execution environment.
13047
+ *
13048
+ * @param properties - Contains the user script world configuration.
13049
+ * @param callback - Callback function to be executed after configuring the world.
13050
+ */
13051
+ export function configureWorld(properties: WorldProperties, callback: () => void): void;
13052
+
13053
+ /**
13054
+ * Returns all dynamically-registered user scripts for this extension.
13055
+ *
13056
+ * @param filter - If specified, this method returns only the user scripts that match it.
13057
+ * @returns A Promise that resolves with the same type that is passed to the callback.
13058
+ */
13059
+ export function getScripts(filter?: UserScriptFilter): Promise<RegisteredUserScript[]>;
13060
+ /**
13061
+ * Returns all dynamically-registered user scripts for this extension.
13062
+ *
13063
+ * @param filter - If specified, this method returns only the user scripts that match it.
13064
+ * @param callback - Callback function to be executed after getting user scripts.
13065
+ */
13066
+ export function getScripts(filter: UserScriptFilter, callback: (scripts: RegisteredUserScript[]) => void): void;
13067
+
13068
+ /**
13069
+ * Registers one or more user scripts for this extension.
13070
+ *
13071
+ * @param scripts - Contains a list of user scripts to be registered.
13072
+ * @returns A Promise that resolves with the same type that is passed to the callback.
13073
+ */
13074
+ export function register(scripts: RegisteredUserScript[]): Promise<void>;
13075
+ /**
13076
+ * Registers one or more user scripts for this extension.
13077
+ *
13078
+ * @param scripts - Contains a list of user scripts to be registered.
13079
+ * @param callback - Callback function to be executed after registering user scripts.
13080
+ */
13081
+ export function register(scripts: RegisteredUserScript[], callback: () => void): void;
13082
+
13083
+ /**
13084
+ * Unregisters all dynamically-registered user scripts for this extension.
13085
+ *
13086
+ * @param filter - If specified, this method unregisters only the user scripts that match it.
13087
+ * @returns A Promise that resolves with the same type that is passed to the callback.
13088
+ */
13089
+ export function unregister(filter?: UserScriptFilter): Promise<void>;
13090
+ /**
13091
+ * Unregisters all dynamically-registered user scripts for this extension.
13092
+ *
13093
+ * @param filter - If specified, this method unregisters only the user scripts that match it.
13094
+ * @param callback - Callback function to be executed after unregistering user scripts.
13095
+ */
13096
+ export function unregister(filter: UserScriptFilter, callback: () => void): void;
13097
+
13098
+ /**
13099
+ * Updates one or more user scripts for this extension.
13100
+ *
13101
+ * @param scripts - Contains a list of user scripts to be updated. A property is only updated for the existing script
13102
+ * if it is specified in this object. If there are errors during script parsing/file validation, or if
13103
+ * the IDs specified do not correspond to a fully registered script, then no scripts are updated.
13104
+ * @returns A Promise that resolves with the same type that is passed to the callback.
13105
+ */
13106
+ export function update(scripts: RegisteredUserScript[]): Promise<void>;
13107
+ /**
13108
+ * Updates one or more user scripts for this extension.
13109
+ *
13110
+ * @param scripts - Contains a list of user scripts to be updated. A property is only updated for the existing script
13111
+ * if it is specified in this object. If there are errors during script parsing/file validation, or if
13112
+ * the IDs specified do not correspond to a fully registered script, then no scripts are updated.
13113
+ * @param callback - Callback function to be executed after updating user scripts.
13114
+ */
13115
+ export function update(scripts: RegisteredUserScript[], callback: () => void): void;
13116
+ }
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.261",
3
+ "version": "0.0.262",
4
4
  "description": "TypeScript definitions for chrome",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -93,6 +93,6 @@
93
93
  "@types/filesystem": "*",
94
94
  "@types/har-format": "*"
95
95
  },
96
- "typesPublisherContentHash": "efcdde01a65393b8e39d4f71d4fb0881751821dfe987bf43139754dd5d65b0b2",
96
+ "typesPublisherContentHash": "5b5f470be4e249565651d73df1c1c67ce65127b4ba01df929a159942f643bd30",
97
97
  "typeScriptVersion": "4.6"
98
98
  }