This is a Worker script that is used as "threaded queue" for managing SCION event execution:
New events for SCION are queued in order to allow raising new events from within SCION-event-processing.
        
        
This "threaded queue" receives messages from the "WebWorker environment engine" of
mmir.dialogEngine - see mmir.state.StateEngineFactory.StateEngineWebWorkerImpl.
The message / work flow is as follows:
- on receiving 
queueJob: add new event-job to the queue - on receiving 
finishedJob: - if queue is empty: does nothing
 - if queue is not empty: take next job from queue and send it as a 
processNextJobmessage to SCION 
Members
- 
    
private,innerqueuesPlainObject
 - 
    
    dictionary of
jobId -> JobQueue- See:
 
 
Methods
- 
    
onmessage(evt)
 - 
    
    Handler for received messages.
Name Type Description evtObject the message object with 
Name Type Description data.command"finishedJob" | "queueJob" | "destroyQueue" the message type / name (e.g. finishedJob) data.engineIdNumber | String Number the engine's ID for which this job should be queued data.jobmodule:workers/scion-queue~Job optional the job object (e.g. in case of command queueJob the job that will be queued)  - 
    
innerdistributeJobs(queue)
 - 
    
    Handler for sending messages.
In case of
finishedJob: take next job for the engine-queue and send it to SCION, i.e. post a message e with
{String} event.data.command = processNextJob
{Object} event.data.job the job object (that was added before to the queue with command / message queueJobName Type Description queuemodule:workers/scion-queue~JobQueue the job queue  - 
    
private,innergetQueue(engineId, isCreate){module:workers/scion-queue~JobQuee}
 - 
    
    HELPER get queue for an engine (ID)
Name Type Description engineIdNumber | String the engine ID isCreateBoolean optional if TRUE, the queue will be created if it does not exist yet Returns:
Type Description module:workers/scion-queue~JobQuee the queue for the engineId (if isCreate is FALSE, and no queue exits for the engineId, it will return UNDEFINED)  
Interface Definitions
- 
    
Job
 - 
    
    the Job object, describing jobs on a JobQueue
 - 
    
JobQueue
 - 
    
    A JobQueue is an Array with additional property JobQueue.readyForJob {Boolean}