wilk / microjob

A tiny wrapper for turning Node.js worker threads into easy-to-use routines for heavy CPU loads.
https://wilk.github.io/microjob/
MIT License
2.02k stars 47 forks source link

can't call functions in workers #28

Closed ddwwcruz closed 5 years ago

ddwwcruz commented 6 years ago

Not sure if it's still within the scope of this project.

I tried making my worker function call other functions but it didn't work. Passing them through ctx didn't work either (tho i guess functions can't be passed to context).

Is it possible to define functions that the worker is able to call?

wilk commented 6 years ago

@ddwwcruz I've added a test in __tests__/context.ts (here: https://github.com/wilk/microjob/commit/c7325fad4d3e2f51e1592e0d417cc793ef346175) so you should be able to reproduce it correctly. Feel free to close the issue if it solves it.

ddwwcruz commented 5 years ago

Finally got around to testing it. Confirmed it works.