Skip to content

Commit

Permalink
support LibraryUtils.terminateWorker() (fixes hanging in jest)
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed May 26, 2023
1 parent bb48a89 commit 3278e24
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/js/common/LibraryUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,17 @@ class LibraryUtils {
return LibraryUtils.WORKER;
}

/**
* Terminate monero-javascript's singleton worker.
*/
static async terminateWorker() {
if (LibraryUtils.WORKER) {
LibraryUtils.WORKER.terminate();
delete LibraryUtils.WORKER;
LibraryUtils.WORKER = undefined;
}
}

/**
* Invoke a worker function and get the result with error handling.
*
Expand Down

0 comments on commit 3278e24

Please sign in to comment.