Class: AsyncCompiler

AsyncCompiler

mmir.env.grammar.AsyncCompiler

Factory for creating WebWorkers that compile grammar-parser

Methods

Create a WebWorker for compiling grammars. The returned WebWorker provides 2 additional convenience functions for communicating with the WebWorker thread: addCallback(taskId : String, callback : Function) where taskId is a unique String identifying a single compile-job and callback handles messages that come back from the WebWorker thread: The callback(eventData) will invoke the callback with the message's data The property eventData.done has a special function: if this property is present with a TRUTHY value, then callback will be removed, i.e. not listening anymore for the specified taskId. After adding a callback, messages to the WebWorker thread can be send with the postMessage({id: taskId, cmd: 'parse', ...})
Name Type Description
parserEngineId String the name of the file that holds the WebWorker implementation. The file must be located in MMIR's Resources#getWorkerPath directory.
Returns:
Type Description
mmir.env.grammar.CompileWebWorker a WebWorker that provides some convenience functions for communicating with the WebWorker/thread.