You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys, maybe I'm wrong and need to give it a better look at service workers but what I'm trying to accomplish is the following:
1- I'd like to pass to greenlet an array of promises like the Promise.all(promises) return.
2- Await for them inside the greenlet function.
3- returning the result to the main app.
Hi @epavan - you can't pass Promises to greenlet, because the code that generates the work those promises represent would still just be running on the main thread.
It's likely you're looking for something more like workerize-loader, which lets you import a module as a Worker:
// validation-auto.jsasyncfunctionvalidationAuto(chunk,workarea,criteria,test_groups){letvalidate;if(window.Worker){// this special import runs the module and its dependencies in a worker:validate=(awaitimport('workerize-loader!./validation-worker')).validate;}else{// if there's no Workers support, we'll just run it all on the main thread:validate=(awaitimport('./validation-worker')).validate;}returnvalidate(chunk,workarea,criteria,test_groups);}
@epavan if i understand your problem right. You can use it just like that, because if u are gonna make promisess you have to make it inside the worker.
Hi guys, maybe I'm wrong and need to give it a better look at service workers but what I'm trying to accomplish is the following:
1- I'd like to pass to greenlet an array of promises like the Promise.all(promises) return.
2- Await for them inside the greenlet function.
3- returning the result to the main app.
This is my code:
Any tip to accomplish it with greenlet? Thanks.
The text was updated successfully, but these errors were encountered: