@lvce-editor/api 9.21.0 → 9.22.0
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.
|
@@ -8,8 +8,9 @@ export interface ElectronWebContentsViewStats {
|
|
|
8
8
|
readonly url: string;
|
|
9
9
|
}
|
|
10
10
|
export interface ElectronWebContentsView {
|
|
11
|
+
readonly click: (selector: string) => Promise<boolean>;
|
|
11
12
|
readonly dispose: () => Promise<void>;
|
|
12
|
-
readonly executeJavaScript: <T = unknown>(code: string) => Promise<T>;
|
|
13
|
+
readonly executeJavaScript: <T = unknown>(code: string, userGesture?: boolean) => Promise<T>;
|
|
13
14
|
readonly getStats: () => Promise<ElectronWebContentsViewStats>;
|
|
14
15
|
readonly loadUrl: (url: string) => Promise<void>;
|
|
15
16
|
readonly reload: () => Promise<void>;
|
|
@@ -38,6 +38,9 @@ export const createElectronWebContentsView = async ({ url } = {}) => {
|
|
|
38
38
|
throw error;
|
|
39
39
|
}
|
|
40
40
|
return {
|
|
41
|
+
async click(selector) {
|
|
42
|
+
return (await rpc.invoke('ElectronWebContentsView.click', id, selector));
|
|
43
|
+
},
|
|
41
44
|
async dispose() {
|
|
42
45
|
if (disposed) {
|
|
43
46
|
return;
|
|
@@ -45,8 +48,8 @@ export const createElectronWebContentsView = async ({ url } = {}) => {
|
|
|
45
48
|
disposed = true;
|
|
46
49
|
await disposeAfterCreateError(rpc, id);
|
|
47
50
|
},
|
|
48
|
-
async executeJavaScript(code) {
|
|
49
|
-
return (await rpc.invoke('ElectronWebContentsView.insertJavaScript', id, code));
|
|
51
|
+
async executeJavaScript(code, userGesture = false) {
|
|
52
|
+
return (await rpc.invoke('ElectronWebContentsView.insertJavaScript', id, code, userGesture));
|
|
50
53
|
},
|
|
51
54
|
async getStats() {
|
|
52
55
|
return (await rpc.invoke('ElectronWebContentsView.getStats', id));
|