Constructor
new Job(promiseProducer, nameopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
promiseProducer |
producerHandler.<Promise.<T>> | A function returning a Promise or an async function (essentially the same). If you want to use a sync function, call Job::fromSyncFunction(fn) instead. | |
name |
String |
<optional> |
Optional. Defaults to undefined. Give an optional name to this job. |
- Source:
- See:
-
- {fromSyncFunction()}
Members
_cost :number
Type:
- number
- Source:
_progressInstance :Progress
Type:
- Source:
_properties :DictionaryMapBased.<any, any>
Type:
- DictionaryMapBased.<any, any>
- Source:
_result :T
Type:
- T
- Source:
_startTime :Date
Type:
- Date
- Source:
_stopTime :Date
Type:
- Date
- Source:
cost
- Source:
cost
- Source:
createTime
- Source:
donePromise
A promise that can be used to await this Job's final state.
If resolved, will resolve with this Job's result. The promise
returned by run() should only be used by the queue.
- Source:
hasFailed
- Source:
isDone
- Source:
isRunning
- Source:
isStopped
- Source:
name
- Source:
name
- Source:
observableDone :Observable.<JobEvent>
Type:
- Observable.<JobEvent>
- Source:
observableFailed :Observable.<JobEvent>
Type:
- Observable.<JobEvent>
- Source:
observableRun :Observable.<JobEvent>
Type:
- Observable.<JobEvent>
- Source:
progress
Use this setter to give this Job an instance of Progress that may be used
by the scheduler for this Job. This Job itself does not observe the instance
or subscribe to its observables.
- Source:
progress
- Source:
properties
- Source:
result
- Source:
runDurationMs
- Source:
startTime
- Source:
stopTime
- Source:
supportsProgress
- Source:
wasStarted
- Source:
Methods
(static) fromProcess(processWrapper) → {Job}
Convenience function to create a Job from a ProcessWrapper. Once run, the
Job will run the ProcessWrapper as Observable. All observed output is then
reported as Progress, as the Job will be decorated with a Progress-instance
of type ProcessOutput.
Parameters:
Name | Type | Description |
---|---|---|
processWrapper |
ProcessWrapper |
- Source:
Returns:
- Type
- Job
(static) fromSyncFunction(func) → {Job}
Creates a job from a synchronous function by wrapping it into an
async function.
Parameters:
Name | Type | Description |
---|---|---|
func |
function | A function that does synchronous work and returns a value (i.e. its result is not awaited). |
- Source:
Returns:
- Type
- Job
(async) run() → {Promise.<T>}
- Source:
Returns:
the Promise that will resolve with the
job's result.
- Type
- Promise.<T>