Class: WorkerSupport

WorkerSupport


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
payload Object

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
builder function

The builder function. Default is THREE.LoaderSupport.Builder.

onLoad function

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
terminateRequested boolean

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
functionCodeBuilder function

Function that is invoked with funcBuildObject and funcBuildSingelton that allows stringification of objects and singletons.

forceWorkerReload boolean

Force re-build of the worker code.

libLocations Array.<String>

URL of libraries that shall be added to worker code relative to libPath

libPath String

Base path used for loading libraries

runnerImpl THREE.LoaderSupport.WorkerRunnerRefImpl

The default worker parser wrapper implementation (communication and execution). An extended class could be passed here.