Private
#controlBoolean to know if the texture compressor should control the hash.
Private
#texturePrevious texture hash.
Private
#tasksA queue of active tasks that this Worker is executing.
Private
#taskAn auto-incrementing task index.
Static
WORKER_A path reference to the JavaScript file which provides companion worker-side functionality.
A Promise which resolves once the Worker is ready to accept tasks
Process the non-blocking image compression to a base64 string.
Buffer used to create the image data.
Buffered image width.
Buffered image height.
The required image type.
The required image quality.
The debug option.
Expand a buffer in RED format to a buffer in RGBA format.
Buffer used to create the image data.
Buffered image width.
Buffered image height.
The debug option.
Reduce a buffer in RGBA format to a buffer in RED format.
Buffer used to create the image data.
Buffered image width.
Buffered image height.
The debug option.
Load a function onto a given Worker. The function must be a pure function with no external dependencies or requirements on global scope.
The name of the function to load
A reference to the function that should be loaded
A Promise which resolves once the Worker has loaded the function.
Execute a task on a specific Worker.
The named function to execute on the worker. This function must first have been loaded.
Optional
args: any[] = []An array of parameters with which to call the requested function
Optional
transfer: any[] = []An array of transferable objects which are transferred to the worker thread. See https://developer.mozilla.org/en-US/docs/Glossary/Transferable_objects
A Promise which resolves with the returned result of the function once complete.
Private
#dispatchDispatch a task to a named Worker, awaiting confirmation of the result.
Data to dispatch to the Worker as part of the task.
An array of transferable objects which are transferred to the worker thread.
A Promise which wraps the task transaction.
Private
#onPrivate
#on
Wrapper for a web worker meant to convert a pixel buffer to the specified image format and quality and return a base64 image
Param: name
The worker name to be initialized
Param: config
Worker initialization options
Param: config.debug
Should the worker run in debug mode?