+9
-2
@@ -56,9 +56,15 @@ function response(id, data, error = "") { | ||
| export function excute(frameID, actionName, ...params) { | ||
| console.log(frameID); | ||
| return new Promise((resolve, reject) => { | ||
| var _a; | ||
| const frame = window.frames[frameID]; | ||
| if (!frame) | ||
| console.log(frame); | ||
| if (!frame) { | ||
| reject(`iframe not found: ${frameID}`); | ||
| return; | ||
| } | ||
| ; | ||
| const id = uuid(); | ||
| function listener(e) { | ||
| console.log(e); | ||
| window.removeEventListener("message", listener); | ||
@@ -88,4 +94,5 @@ let resp = {}; | ||
| const requestData = { id, actionName, params }; | ||
| (_a = frame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(JSON.stringify(requestData), frame.src); | ||
| console.log(requestData); | ||
| (_a = frame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(JSON.stringify(requestData), "*"); | ||
| }); | ||
| } |
+1
-1
@@ -89,4 +89,4 @@ function response(id: string, data: any, error = "") { | ||
| const requestData = { id, actionName, params }; | ||
| frame.contentWindow?.postMessage(JSON.stringify(requestData), "*"); | ||
| frame.contentWindow?.postMessage(JSON.stringify(requestData), frame.src); | ||
| }); | ||
| } |
+1
-1
| { | ||
| "name": "ifapi", | ||
| "version": "1.1.9", | ||
| "version": "1.2.2", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
8418
2.4%184
3.95%