new WorkerSupport(logger)
This class provides means to transform existing parser code into a web worker. It defines a simple communication protocol which allows to configure the worker and receive raw mesh data during execution.
Parameters:
| Name | Type | Description |
|---|---|---|
logger |
THREE.LoaderSupport.ConsoleLogger | logger to be used |
Methods
-
<static> WorkerSupport#run(payload)
-
Runs the parser with the provided configuration.
Parameters:
Name Type Description payloadObject Raw mesh description (buffers, params, materials) used to build one to many meshes.
-
<static> WorkerSupport#setCallbacks(builder, onLoad)
-
Specify functions that should be build when new raw mesh data becomes available and when the parser is finished.
Parameters:
Name Type Description builderfunction The builder function. Default is THREE.LoaderSupport.Builder.
onLoadfunction The function that is called when parsing is complete.
-
<static> WorkerSupport#setTerminateRequested(terminateRequested)
-
Request termination of worker once parser is finished.
Parameters:
Name Type Description terminateRequestedboolean True or false.
-
<static> WorkerSupport#terminateWorker()
-
Terminate the worker and the code.
-
<static> WorkerSupport#validate(functionCodeBuilder, forceWorkerReload, libLocations, libPath, runnerImpl)
-
Validate the status of worker code and the derived worker.
Parameters:
Name Type Description functionCodeBuilderfunction Function that is invoked with funcBuildObject and funcBuildSingelton that allows stringification of objects and singletons.
forceWorkerReloadboolean Force re-build of the worker code.
libLocationsArray.<String> URL of libraries that shall be added to worker code relative to libPath
libPathString Base path used for loading libraries
runnerImplTHREE.LoaderSupport.WorkerRunnerRefImpl The default worker parser wrapper implementation (communication and execution). An extended class could be passed here.