Skip to content

Commit

Permalink
fix: events not emitted from offloaded functions (#439)
Browse files Browse the repository at this point in the history
When using worker-pool in a browser environment, worker function registration does not work.
Only `pool.exec(<function>)` can be run, but does not handle the on message callbacks

Referenced doc: https://github.com/josdejong/workerpool#events
Playground: https://codesandbox.io/p/sandbox/workerpool-in-a-react-project-forked-dgjxxc
  • Loading branch information
w1nklr committed Apr 6, 2024
1 parent 6b0b1b0 commit aef7e7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Pool.prototype.exec = function (method, params, options) {
}
else if (typeof method === 'function') {
// send stringified function and function arguments to worker
return this.exec('run', [String(method), params]);
return this.exec('run', [String(method), params], options);
}
else {
throw new TypeError('Function or string expected as argument "method"');
Expand Down

0 comments on commit aef7e7d

Please sign in to comment.