-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Not working everywhere, is there anything wrong? #1
Comments
Hmm, darn... To answer your issues: Node.js:
Bun.js:Hmm, seems like there are bigger issues here... so this package will likely not even work in bun.js until they implement something i have never actually really tested out bun.js before until today. denohmm, 🤔 i have actually tested this package out in deno by running:
so maybe try this out in deno: import { createWorker } from 'https://esm.sh/[email protected]/mod.js'
onst awaitSync = createWorker();
const sync = awaitSync(async () => {
return new Uint8Array();
});
console.log(sync()); |
I'm using v18.16.0 On Node 19, it works a bit unexpectedly: import { createWorker } from 'await-sync'
const awaitSync = createWorker();
const sync = awaitSync(async () => {
console.log('xxxx')
return new Uint8Array([0, 1]);
});
console.log(sync());
For Deno, And Deno runs in the expected sequence:
|
Hmm 🤔
I'm going to put in some investigation into trying to get it to work on older and newer nodejs versions. I wanted my whatwg-worker to support importing stuff from blob urls and https imports too. it was a little side-dependency/useful tool i wanted to have along with this project so both are relative new both are not even 3 weeks old. So excuse me if things are not working properly. To support importing from other sources other than npm i had to add in experimental loaders flag when starting up The reason for doing so was so that i could import code that is dynamically created. blob = new Blob([code])
url = URL.createObjectURL(blob)
import(url) And |
I may have found a way to improve the logging while the main thread is blocking. i found out how NodeJS do it here: https://github.com/nodejs/node/blob/0b3fcfcf351fba9f29234976eeec4afb09ae2cc0/lib/internal/worker/io.js#L360-L396 It basically did confirmed what i tough and said. they send the logs to the parent thread instead with postMessages. An alternative solution would be to take the I'm experimenting with it now. to be able to console log stuff while the main thread is blocked Edit |
Hmm, i guess you have used a package.json when running deno? i have had this in the package.json "exports": {
"browser": "./browser-worker.js",
"node": "./node-worker.js"
}, do you think that is the reason why? "exports": {
"browser": "./browser-worker.js",
"deno": "./browser-worker.js",
"node": "./node-worker.js"
}, |
1.0.1 release 🎉 fixes console logs so they logs in the correct order so
|
Node.js:
Bun.js:
Deno
The text was updated successfully, but these errors were encountered: