Disable Web Workers on browsers without MessageChannel support
For compatibility with old Firefox / Pale Moon 27
This commit is contained in:
parent
3a2408d0f1
commit
95cc9cecf0
|
@ -65,7 +65,7 @@ let asyncProxy; // instance of the asyncproxy
|
||||||
* @param {Array<Object>} workers alternative to path parameter: web workers initialized with 'openpgp.worker.js'
|
* @param {Array<Object>} workers alternative to path parameter: web workers initialized with 'openpgp.worker.js'
|
||||||
*/
|
*/
|
||||||
export function initWorker({ path='openpgp.worker.js', n = 1, workers = [] } = {}) {
|
export function initWorker({ path='openpgp.worker.js', n = 1, workers = [] } = {}) {
|
||||||
if (workers.length || (typeof window !== 'undefined' && window.Worker)) {
|
if (workers.length || (typeof window !== 'undefined' && window.Worker && window.MessageChannel)) {
|
||||||
asyncProxy = new AsyncProxy({ path, n, workers, config });
|
asyncProxy = new AsyncProxy({ path, n, workers, config });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user