-
Notifications
You must be signed in to change notification settings - Fork 298
Feature/add workerize utility #2617
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2617 +/- ##
======================================
Coverage 45.3% 45.3%
======================================
Files 361 361
Lines 14571 14571
Branches 1912 1912
======================================
Hits 6601 6601
Misses 7746 7746
Partials 224 224 Continue to review full report at Codecov.
|
Thanks for introducing this, @Akin909 !
That's a bummer. I wonder why they need process? Potentially, we could fork Would it be possible to add a quick test case demonstrating its usage? Even just a simple test case like: let result = await workerize(({a, b}) => a + b, {a: 2, b: 3}); (Essentially its documentation on how this can be used 😄 ) |
return webWorker.postMessage(result) | ||
} | ||
|
||
// courtesy of this gem - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find!
@bryphe sure will add a simple test to this PR. Re. vscode-textmate and the use of process they use it to have access to env variables for debugging as well as for one particular script that can be run from the commandline. I had the same thought re. forking the library was trying to decide between that and waiting to see if the issue that relates to that for the loader moves forward at all and we might be able to bypass the need, although not sure as the package seems intended for node as opposed to the browser |
cc @bryphe
I've been experimenting with worker support still, and discovered a very minimal way to execute a pure function in a separate thread, this is similar to the
greenlet
library just even smaller.It takes a function, and its arguments and runs the code in a separate thread, unfortunately I can't find any expensive pure functions to use it on.
I'm working on the syntaxHighlightingPeriodicJob on another branch, unfortunately it has quite a few external dependencies, currently blocked by the fact that
vscode-textmate
references the process variable which is undefined in the worker thread so causes errors