@types/chrome 0.0.316 → 0.0.317

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 +45 -0
  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: Tue, 22 Apr 2025 15:36:51 GMT
11
+ * Last updated: Thu, 24 Apr 2025 16:02:45 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
@@ -14860,6 +14860,18 @@ declare namespace chrome {
14860
14860
  */
14861
14861
  export type ExecutionWorld = "MAIN" | "USER_SCRIPT";
14862
14862
 
14863
+ /** @since Chrome 135 */
14864
+ export interface InjectionResult {
14865
+ /** The document associated with the injection. */
14866
+ documentId: string;
14867
+ /** The error, if any. `error` and `result` are mutually exclusive. */
14868
+ error?: string;
14869
+ /** The frame associated with the injection. */
14870
+ frameId: number;
14871
+ /** The result of the script execution. */
14872
+ result: any;
14873
+ }
14874
+
14863
14875
  export interface WorldProperties {
14864
14876
  /** Specifies the world csp. The default is the `ISOLATED` world csp. */
14865
14877
  csp?: string;
@@ -14876,6 +14888,18 @@ declare namespace chrome {
14876
14888
  ids?: string[];
14877
14889
  }
14878
14890
 
14891
+ /** @since Chrome 135 */
14892
+ export interface InjectionTarget {
14893
+ /** Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` is specified. */
14894
+ allFrames?: boolean;
14895
+ /** The IDs of specific documentIds to inject into. This must not be set if `frameIds` is set. */
14896
+ documentIds?: string[];
14897
+ /** The IDs of specific frames to inject into. */
14898
+ frameIds?: number[];
14899
+ /** The ID of the tab into which to inject. */
14900
+ tabId: number;
14901
+ }
14902
+
14879
14903
  export interface RegisteredUserScript {
14880
14904
  /** 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. */
14881
14905
  allFrames?: boolean;
@@ -14902,6 +14926,20 @@ declare namespace chrome {
14902
14926
  worldId?: string;
14903
14927
  }
14904
14928
 
14929
+ /** @since Chrome 135 */
14930
+ export interface UserScriptInjection {
14931
+ /** Whether the injection should be triggered in the target as soon as possible. Note that this is not a guarantee that injection will occur prior to page load, as the page may have already loaded by the time the script reaches the target. */
14932
+ injectImmediately?: boolean;
14933
+ /** The list of ScriptSource objects defining sources of scripts to be injected into the target. */
14934
+ js: ScriptSource[];
14935
+ /** Details specifying the target into which to inject the script. */
14936
+ target: InjectionTarget;
14937
+ /** The JavaScript "world" to run the script in. The default is `USER_SCRIPT`. */
14938
+ world?: ExecutionWorld;
14939
+ /** Specifies the user script world ID to execute in. If omitted, the script will execute in the default user script world. Only valid if `world` is omitted or is `USER_SCRIPT`. Values with leading underscores (`_`) are reserved. */
14940
+ worldId?: string;
14941
+ }
14942
+
14905
14943
  /**
14906
14944
  * Properties for a script source.
14907
14945
  */
@@ -14954,6 +14992,13 @@ declare namespace chrome {
14954
14992
  export function getWorldConfigurations(): Promise<WorldProperties[]>;
14955
14993
  export function getWorldConfigurations(callback: (worlds: WorldProperties[]) => void): void;
14956
14994
 
14995
+ /**
14996
+ * Injects a script into a target context. By default, the script will be run at `document_idle`, or immediately if the page has already loaded. If the `injectImmediately` property is set, the script will inject without waiting, even if the page has not finished loading. If the script evaluates to a promise, the browser will wait for the promise to settle and return the resulting value.
14997
+ * @since Chrome 135
14998
+ */
14999
+ export function execute(injection: UserScriptInjection): Promise<InjectionResult[]>;
15000
+ export function execute(injection: UserScriptInjection, callback: (result: InjectionResult[]) => void): void;
15001
+
14957
15002
  /**
14958
15003
  * Registers one or more user scripts for this extension.
14959
15004
  *
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.316",
3
+ "version": "0.0.317",
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": "ef2848ec857a2961c7b3f4fac265c8c66f7f87ed4ee074e89fa66558db476a76",
97
+ "typesPublisherContentHash": "51383207b6d9937576adc2f632282ec8fd885e1ba1012d8b479079f2640cc452",
98
98
  "typeScriptVersion": "5.1"
99
99
  }