ElectronWebFrame.executeJavaScriptInIsolatedWorld method
ElectronWebFrame › executeJavaScriptInIsolatedWorld
Unofficial
Works likeexecuteJavaScript but evaluates scripts in an isolated context. When the execution of a script fails, the returned promise will not reject and the result would be undefined. Signature:
executeJavaScriptInIsolatedWorld(worldId: number, scripts: ElectronWebSource[], userGesture?: boolean | undefined, callback?: ((result: unknown, error: Error) => void) | undefined): Promise<unknown>Parameters:
| Parameter | Type | Description |
|---|---|---|
| worldId | number | The id of the isolated world to run the scripts in. |
| scripts | ElectronWebSource[] | The scripts to evaluate. |
| userGesture? | boolean | undefined | Whether to treat the evaluation as being triggered by a user gesture. |
| callback? | ((result: unknown, error: Error) => void) | undefined | Called with the result of the executed code. Modeled with unknown (the upstream result type is any). |
Returns: Promise<unknown> — A promise that resolves with the result of the executed code, or is rejected if execution could not start. Modeled with unknown (the upstream type is any).