-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
postMessage used in README before it's explained #36
Comments
Anything specifically you’d like to see here? It’s mentioned in the HTML Integration section, so it’s referring to postMessage as defined in HTML. |
Sorry I should have provided more detail: Let's say I knew nothing about this proposal, and read the README from top to bottom. I get to this section: HTML IntegrationModule blocks can be turned into an Object URL using const module = module { export default 42; }
const moduleURL = URL.createObjectURL(module);
assert(await import(module) === await import(moduleURL));
// main.js
const module = module {
export async function main(url) {
return import.meta.url;
}
}
const worker = new Worker("./module-executor.js");
worker.postMessage(module);
worker.onmessage = ({data}) => assert(data == import.meta.url);
// module-executor.js
addEventListener("message", async ({data}) => {
const {main} = await import(data);
postMessage(await main());
});
I guess "Use with workers" should appear before examples that use post-messaging incidentally. Or, make the point about Additionally, the stuff about |
postMessage
ing a module appears in an example in the "HTML Integration" section, before the concept ofpostMessage
ing modules is introduced.The text was updated successfully, but these errors were encountered: