Skip to content

Module: lib/util/supportsWorkerModules

Detects whether the browser supports Web Workers with ES6 module syntax (type: 'module').

Version
1.0.0
Author
Frank Kudermann - alphanull
License
MIT
Source
supportsWorkerModules.js, line 1

Methods

static supportsWorkerModules() → Promise<boolean>

This function attempts to create a Web Worker with an ES6 module and sends a test message to verify support. It creates a Worker from a Blob and attempts to run code that checks if type: 'module' works for Workers. The function uses eval() to run a base64-encoded Worker script since importScripts cannot be used with ES6 modules.

Returns

A promise that resolves to true if ES6 module Workers are supported, otherwise false.

Type Promise<boolean>
Source
supportsWorkerModules.js, line 17