Skip to content

Commit

Permalink
Ensure Worker is terminated after use
Browse files Browse the repository at this point in the history
  • Loading branch information
WillNewmarch committed Mar 4, 2022
1 parent b4816a9 commit 6277aa8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bifur",
"description": "A library providing simple use of asynchronous functionality via Web Workers.",
"version": "1.0.4",
"version": "1.0.5",
"author": "Will Newmarch",
"repository": {
"type": "git",
Expand Down
4 changes: 3 additions & 1 deletion src/Bifur.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export default class Bifur {
static run(fnc: Function, args: Array<any>): Function {
const worker: Worker = Builder.build(window, fnc);
const wrapper: Function = Wrapper.wrap(worker);
return wrapper(args);
const result = wrapper(args);
worker.terminate();
return result;
}
}

0 comments on commit 6277aa8

Please sign in to comment.