@pbkit/wrp
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -10,2 +10,3 @@ "use strict"; | ||
await handshake(child, childWindowOrigin); | ||
globalThis.addEventListener("message", messageHandler); | ||
const healthcheckId = setInterval(healthcheck, 100); | ||
@@ -30,2 +31,3 @@ const glue = (0, index_1.createGlue)(); | ||
clearInterval(healthcheckId); | ||
globalThis.removeEventListener("message", messageHandler); | ||
glue.close(); | ||
@@ -38,2 +40,10 @@ onClosed === null || onClosed === void 0 ? void 0 : onClosed(); | ||
} | ||
function messageHandler(e) { | ||
if (e.source !== parent) | ||
return; | ||
if (!(0, web_1.isGlueEvent)(e)) | ||
return; | ||
const [, data] = e.data; | ||
glue.recv(data); | ||
} | ||
} | ||
@@ -40,0 +50,0 @@ exports.createChildWindowSocket = createChildWindowSocket; |
{ | ||
"name": "@pbkit/wrp", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"author": "JongChan Choi <jong@chan.moe>", | ||
@@ -5,0 +5,0 @@ "license": "(MIT OR Apache-2.0)", |
140752
2990