Skip to content

Commit

Permalink
Merge pull request #149 from iden3/fix/use-native-worker
Browse files Browse the repository at this point in the history
Use native Worker for ES module browser build
  • Loading branch information
OBrezhniev authored Apr 9, 2024
2 parents 0d30b77 + a781b52 commit 6656038
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
26 changes: 1 addition & 25 deletions build/browser.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2757,10 +2757,6 @@ class EC {

}

function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}

var utils$6 = {};

/*
Expand Down Expand Up @@ -15646,26 +15642,6 @@ function thread(self) {
return runTask;
}

/**
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

var browser = Worker;

var Worker$1 = /*@__PURE__*/getDefaultExportFromCjs(browser);

/*
Copyright 2019 0KIMS association.

Expand Down Expand Up @@ -15772,7 +15748,7 @@ async function buildThreadManager(wasm, singleThread) {

for (let i = 0; i<concurrency; i++) {

tm.workers[i] = new Worker$1(workerSource);
tm.workers[i] = new Worker(workerSource);

tm.workers[i].addEventListener("message", getOnMsg(i));

Expand Down
1 change: 1 addition & 0 deletions rollup.browser.esm.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default [
* https://github.com/iden3/snarkjs/blob/ef9042451f98f254b520b8ce9b9544a849e90a5d/config/rollup.iife.config.js
*/
"process.browser": true,
"import Worker from \"web-worker\"": "",
/*
Because of some frontend frameworks uses monkey patching to track UI changes or other purposes (including Angular, AngularJS, Ember.js, JQuery...), it's important to make sure that the thread function is not modified by the framework and passing in the web worker as it is.
*/
Expand Down

0 comments on commit 6656038

Please sign in to comment.