Closed SeriousMonk closed 3 years ago
Oh I see, does the function need to be written in js and imported from a js file?
Hello thank you for your feedback.
First of all, one of the limitations of JsIsolatedWorker
is that it cannot consume Dart closures (functions). So in order for it to work properly, we need existing native JavaScript closures/functions, either provided by the browser (e.g. JSON.stringify) or by users. If users provide their own JS functions in a file, it is mandatory to import the files first using JsIsolatedWorker.importScripts
.
Lastly, I forgot to put a side note at the end of the README that users need to download worker.js and put it on their web folder in order for JsIsolatedWorker
to work properly.
I hope that answers your confusion😄
Thank you for the quick reply! So to run that dart function I included in the issue would be impossible using this package? I would have to somehow obtain the same result of that dart function but in javascript?
Yes, that is correct, at least for now
Okay thank you very much for your help :)
Hi, I am currently getting the following error:
I am calling the JsIsolatedWorker like this:
and this is the function I am trying to run in the worker:
I probably didn't understand how this package is supposed to be used on web; could you point me in the right direction?