-
-
Save Zemnmez/c0566114430e25138a31a7a39758824e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function main() { | |
window.parent.postMessage("ready", "*"); | |
const config = await new Promise((ok, fail) => { | |
console.log("waiting for config...") | |
window.addEventListener("message", ({ data }) => { | |
console.log("got config message"); | |
if (data.type !== "config") return fail(`did not get config, instead got ${JSON.stringify(data)}`); | |
return ok(data); | |
}, { once: true }) | |
}); | |
console.log({ config }); | |
console.log("now any data the null origin gets is sent to the icloud iframe..."); | |
window.addEventListener("message", ({ data }) => { | |
console.log("forwarding to idmsa", data) | |
window.top.frames[config.idmsaFrameId].postMessage(data, "*"); | |
}); | |
} | |
main().catch(e => console.error(e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment