task-wrapper v1.1.0
Index
Classes
Interfaces
Type aliases
Events
Type aliases
Job
Ƭ Job: function
Type declaration
▸(request?: E): R
| Promise
<R
>
Parameters:
Param
Type
Optional
request
E
Returns: R
| Promise
<R
>
TaskData
Ƭ TaskData: object
Type declaration
Optional
errors: []
Optional
progress: undefined
| number
Optional
request: E
Optional
result: R
Optional
sessionId: undefined
| string
Optional
timeout: Timeout
Events
Controllable
Controllable:
Methods for controlling a task params: TaskData
params: TaskData
cancel
▸ cancel(reason?: any
): void
Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.
Parameters:
Param
Type
Description
Optional
reason
any
Returns: void
reset
▸ reset(): void
Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.
If the task is running a job, the job is first cancelled (cancel()).
Returns: void
restart
▸ restart(request?: E): void
Resets the task (cancelling any running job) and starts it anew with the supplied request.
Parameters:
Param
Type
Description
Optional
request
E
Returns: void
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.
Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start
Parameters:
Param
Type
Description
Optional
request
E
Returns: Promise
<RunningJob<E
, R
>>
Task
Task:
Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.
constructor
⊕ new Task(opts?: TaskOptions<E
, R
>): Task
Parameters:
Param
Type
Description
Optional
opts
TaskOptions<E
, R
>
Returns: Task
<Optional>
dataProxy
● dataProxy: DataProxy
<TaskData<E
, R
>>
<Optional>
job
● job: Job<E
, R
>
addListener
▸ addListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
cancel
▸ cancel(reason?: any
): void
Parameters:
Param
Type
Description
Optional
reason
any
Returns: void
done
▸ done(sessionId: string
, result?: R): void
Parameters:
Param
Type
Description
sessionId
string
-
Optional
result
R
-
Returns: void
emit
▸ emit(event: * string
| symbol
, ...args: *any
[]): boolean
Parameters:
Param
Type
event
string
| symbol
Rest
args
any
[]
Returns: boolean
error
▸ error(sessionId: string
, reason?: any
): void
Parameters:
Param
Type
Description
sessionId
string
-
Optional
reason
any
-
Returns: void
eventNames
▸ eventNames(): Array
< string
| symbol
>
Returns: Array
< string
| symbol
>
getMaxListeners
▸ getMaxListeners(): number
Returns: number
listenerCount
▸ listenerCount(type: * string
| symbol
*): number
Parameters:
Param
Type
type
string
| symbol
Returns: number
listeners
▸ listeners(event: * string
| symbol
*): Function
[]
Parameters:
Param
Type
event
string
| symbol
Returns: Function
[]
off
▸ off(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
on
▸ on(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
once
▸ once(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
prependListener
▸ prependListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
prependOnceListener
▸ prependOnceListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
rawListeners
▸ rawListeners(event: * string
| symbol
*): Function
[]
Parameters:
Param
Type
event
string
| symbol
Returns: Function
[]
removeAllListeners
▸ removeAllListeners(event?: * string
| symbol
*): this
Parameters:
Param
Type
Optional
event
string
| symbol
Returns: this
removeListener
▸ removeListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
reset
▸ reset(): void
Returns: void
restart
▸ restart(request?: E): Promise
<RunningJob<E
, R
>>
Parameters:
Param
Type
Description
Optional
request
E
Returns: Promise
<RunningJob<E
, R
>>
setMaxListeners
▸ setMaxListeners(n: number
): this
Parameters:
Param
Type
n
number
Returns: this
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Starts the task.
Parameters:
Param
Type
Description
Optional
request
E
-
Returns: Promise
<RunningJob<E
, R
>>
update
▸ update(sessionId: string
, progress: number
): void
Parameters:
Param
Type
Description
sessionId
string
-
progress
number
Returns: void
Index
Classes
Interfaces
Type aliases
Events
Type aliases
Job
Ƭ Job: function
Type declaration
▸(request?: E): R
| Promise
<R
>
Parameters:
Param
Type
Optional
request
E
Returns: R
| Promise
<R
>
TaskData
Ƭ TaskData: object
Type declaration
Optional
errors: []
Optional
progress: undefined
| number
Optional
request: E
Optional
result: R
Optional
sessionId: undefined
| string
Optional
timeout: Timeout
Events
Controllable
Controllable:
Methods for controlling a task params: TaskData
params: TaskData
cancel
▸ cancel(reason?: any
): void
Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.
Parameters:
Param
Type
Description
Optional
reason
any
Returns: void
reset
▸ reset(): void
Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.
If the task is running a job, the job is first cancelled (cancel()).
Returns: void
restart
▸ restart(request?: E): void
Resets the task (cancelling any running job) and starts it anew with the supplied request.
Parameters:
Param
Type
Description
Optional
request
E
Returns: void
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.
Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start
Parameters:
Param
Type
Description
Optional
request
E
Returns: Promise
<RunningJob<E
, R
>>
Task
Task:
Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.
constructor
⊕ new Task(opts?: TaskOptions<E
, R
>): Task
Parameters:
Param
Type
Description
Optional
opts
TaskOptions<E
, R
>
Returns: Task
<Optional>
dataProxy
● dataProxy: DataProxy
<TaskData<E
, R
>>
<Optional>
job
● job: Job<E
, R
>
addListener
▸ addListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
cancel
▸ cancel(reason?: any
): void
Parameters:
Param
Type
Description
Optional
reason
any
Returns: void
done
▸ done(sessionId: string
, result?: R): void
Parameters:
Param
Type
Description
sessionId
string
-
Optional
result
R
-
Returns: void
emit
▸ emit(event: * string
| symbol
, ...args: *any
[]): boolean
Parameters:
Param
Type
event
string
| symbol
Rest
args
any
[]
Returns: boolean
error
▸ error(sessionId: string
, reason?: any
): void
Parameters:
Param
Type
Description
sessionId
string
-
Optional
reason
any
-
Returns: void
eventNames
▸ eventNames(): Array
< string
| symbol
>
Returns: Array
< string
| symbol
>
getMaxListeners
▸ getMaxListeners(): number
Returns: number
listenerCount
▸ listenerCount(type: * string
| symbol
*): number
Parameters:
Param
Type
type
string
| symbol
Returns: number
listeners
▸ listeners(event: * string
| symbol
*): Function
[]
Parameters:
Param
Type
event
string
| symbol
Returns: Function
[]
off
▸ off(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
on
▸ on(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
once
▸ once(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
prependListener
▸ prependListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
prependOnceListener
▸ prependOnceListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
rawListeners
▸ rawListeners(event: * string
| symbol
*): Function
[]
Parameters:
Param
Type
event
string
| symbol
Returns: Function
[]
removeAllListeners
▸ removeAllListeners(event?: * string
| symbol
*): this
Parameters:
Param
Type
Optional
event
string
| symbol
Returns: this
removeListener
▸ removeListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
reset
▸ reset(): void
Returns: void
restart
▸ restart(request?: E): Promise
<RunningJob<E
, R
>>
Parameters:
Param
Type
Description
Optional
request
E
Returns: Promise
<RunningJob<E
, R
>>
setMaxListeners
▸ setMaxListeners(n: number
): this
Parameters:
Param
Type
n
number
Returns: this
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Starts the task.
Parameters:
Param
Type
Description
Optional
request
E
-
Returns: Promise
<RunningJob<E
, R
>>
update
▸ update(sessionId: string
, progress: number
): void
Parameters:
Param
Type
Description
sessionId
string
-
progress
number
Returns: void
Index
Classes
Interfaces
Type aliases
Events
Type aliases
Job
Ƭ Job: function
Type declaration
▸(request?: E): R
| Promise
<R
>
Parameters:
Param
Type
Optional
request
E
Returns: R
| Promise
<R
>
TaskData
Ƭ TaskData: object
Type declaration
Optional
errors: []
Optional
progress: undefined
| number
Optional
request: E
Optional
result: R
Optional
sessionId: undefined
| string
Optional
timeout: Timeout
Events
Controllable
Controllable:
Methods for controlling a task params: TaskData
params: TaskData
cancel
▸ cancel(reason?: any
): void
Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.
Parameters:
Param
Type
Description
Optional
reason
any
Returns: void
reset
▸ reset(): void
Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.
If the task is running a job, the job is first cancelled (cancel()).
Returns: void
restart
▸ restart(request?: E): void
Resets the task (cancelling any running job) and starts it anew with the supplied request.
Parameters:
Param
Type
Description
Optional
request
E
Returns: void
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.
Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start
Parameters:
Param
Type
Description
Optional
request
E
Returns: Promise
<RunningJob<E
, R
>>
Task
Task:
Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.
constructor
⊕ new Task(opts?: TaskOptions<E
, R
>): Task
Parameters:
Param
Type
Description
Optional
opts
TaskOptions<E
, R
>
Returns: Task
<Optional>
dataProxy
● dataProxy: DataProxy
<TaskData<E
, R
>>
<Optional>
job
● job: Job<E
, R
>
addListener
▸ addListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
cancel
▸ cancel(reason?: any
): void
Parameters:
Param
Type
Description
Optional
reason
any
Returns: void
done
▸ done(sessionId: string
, result?: R): void
Parameters:
Param
Type
Description
sessionId
string
-
Optional
result
R
-
Returns: void
emit
▸ emit(event: * string
| symbol
, ...args: *any
[]): boolean
Parameters:
Param
Type
event
string
| symbol
Rest
args
any
[]
Returns: boolean
error
▸ error(sessionId: string
, reason?: any
): void
Parameters:
Param
Type
Description
sessionId
string
-
Optional
reason
any
-
Returns: void
eventNames
▸ eventNames(): Array
< string
| symbol
>
Returns: Array
< string
| symbol
>
getMaxListeners
▸ getMaxListeners(): number
Returns: number
listenerCount
▸ listenerCount(type: * string
| symbol
*): number
Parameters:
Param
Type
type
string
| symbol
Returns: number
listeners
▸ listeners(event: * string
| symbol
*): Function
[]
Parameters:
Param
Type
event
string
| symbol
Returns: Function
[]
off
▸ off(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
on
▸ on(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
once
▸ once(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
prependListener
▸ prependListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
prependOnceListener
▸ prependOnceListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
rawListeners
▸ rawListeners(event: * string
| symbol
*): Function
[]
Parameters:
Param
Type
event
string
| symbol
Returns: Function
[]
removeAllListeners
▸ removeAllListeners(event?: * string
| symbol
*): this
Parameters:
Param
Type
Optional
event
string
| symbol
Returns: this
removeListener
▸ removeListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
reset
▸ reset(): void
Returns: void
restart
▸ restart(request?: E): Promise
<RunningJob<E
, R
>>
Parameters:
Param
Type
Description
Optional
request
E
Returns: Promise
<RunningJob<E
, R
>>
setMaxListeners
▸ setMaxListeners(n: number
): this
Parameters:
Param
Type
n
number
Returns: this
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Starts the task.
Parameters:
Param
Type
Description
Optional
request
E
-
Returns: Promise
<RunningJob<E
, R
>>
update
▸ update(sessionId: string
, progress: number
): void
Parameters:
Param
Type
Description
sessionId
string
-
progress
number
Returns: void
Index
Classes
Interfaces
Type aliases
Events
Type aliases
Job
Ƭ Job: function
Type declaration
▸(request?: E): R
| Promise
<R
>
Parameters:
Param
Type
Optional
request
E
Returns: R
| Promise
<R
>
TaskData
Ƭ TaskData: object
Type declaration
Optional
errors: []
Optional
progress: undefined
| number
Optional
request: E
Optional
result: R
Optional
sessionId: undefined
| string
Optional
timeout: Timeout
Events
Controllable
Controllable:
Methods for controlling a task params: TaskData
params: TaskData
cancel
▸ cancel(reason?: any
): void
Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.
Parameters:
Param
Type
Description
Optional
reason
any
Returns: void
reset
▸ reset(): void
Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.
If the task is running a job, the job is first cancelled (cancel()).
Returns: void
restart
▸ restart(request?: E): void
Resets the task (cancelling any running job) and starts it anew with the supplied request.
Parameters:
Param
Type
Description
Optional
request
E
Returns: void
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.
Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start
Parameters:
Param
Type
Description
Optional
request
E
Returns: Promise
<RunningJob<E
, R
>>
Task
Task:
Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.
constructor
⊕ new Task(opts?: TaskOptions<E
, R
>): Task
Parameters:
Param
Type
Description
Optional
opts
TaskOptions<E
, R
>
Returns: Task
<Optional>
dataProxy
● dataProxy: DataProxy
<TaskData<E
, R
>>
<Optional>
job
● job: Job<E
, R
>
addListener
▸ addListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
cancel
▸ cancel(reason?: any
): void
Parameters:
Param
Type
Description
Optional
reason
any
Returns: void
done
▸ done(sessionId: string
, result?: R): void
Parameters:
Param
Type
Description
sessionId
string
-
Optional
result
R
-
Returns: void
emit
▸ emit(event: * string
| symbol
, ...args: *any
[]): boolean
Parameters:
Param
Type
event
string
| symbol
Rest
args
any
[]
Returns: boolean
error
▸ error(sessionId: string
, reason?: any
): void
Parameters:
Param
Type
Description
sessionId
string
-
Optional
reason
any
-
Returns: void
eventNames
▸ eventNames(): Array
< string
| symbol
>
Returns: Array
< string
| symbol
>
getMaxListeners
▸ getMaxListeners(): number
Returns: number
listenerCount
▸ listenerCount(type: * string
| symbol
*): number
Parameters:
Param
Type
type
string
| symbol
Returns: number
listeners
▸ listeners(event: * string
| symbol
*): Function
[]
Parameters:
Param
Type
event
string
| symbol
Returns: Function
[]
off
▸ off(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
on
▸ on(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
once
▸ once(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
prependListener
▸ prependListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
prependOnceListener
▸ prependOnceListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
rawListeners
▸ rawListeners(event: * string
| symbol
*): Function
[]
Parameters:
Param
Type
event
string
| symbol
Returns: Function
[]
removeAllListeners
▸ removeAllListeners(event?: * string
| symbol
*): this
Parameters:
Param
Type
Optional
event
string
| symbol
Returns: this
removeListener
▸ removeListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
reset
▸ reset(): void
Returns: void
restart
▸ restart(request?: E): Promise
<RunningJob<E
, R
>>
Parameters:
Param
Type
Description
Optional
request
E
Returns: Promise
<RunningJob<E
, R
>>
setMaxListeners
▸ setMaxListeners(n: number
): this
Parameters:
Param
Type
n
number
Returns: this
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Starts the task.
Parameters:
Param
Type
Description
Optional
request
E
-
Returns: Promise
<RunningJob<E
, R
>>
update
▸ update(sessionId: string
, progress: number
): void
Parameters:
Param
Type
Description
sessionId
string
-
progress
number
Returns: void
Index
Classes
Interfaces
Type aliases
Events
Type aliases
Job
Ƭ Job: function
Type declaration
▸(request?: E): R
| Promise
<R
>
Parameters:
Param
Type
Optional
request
E
Returns: R
| Promise
<R
>
TaskData
Ƭ TaskData: object
Type declaration
Optional
errors: []
Optional
progress: undefined
| number
Optional
request: E
Optional
result: R
Optional
sessionId: undefined
| string
Optional
timeout: Timeout
Events
Controllable
Controllable:
Methods for controlling a task params: TaskData
params: TaskData
cancel
▸ cancel(reason?: any
): void
Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.
Parameters:
Param
Type
Description
Optional
reason
any
Returns: void
reset
▸ reset(): void
Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.
If the task is running a job, the job is first cancelled (cancel()).
Returns: void
restart
▸ restart(request?: E): void
Resets the task (cancelling any running job) and starts it anew with the supplied request.
Parameters:
Param
Type
Description
Optional
request
E
Returns: void
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.
Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start
Parameters:
Param
Type
Description
Optional
request
E
Returns: Promise
<RunningJob<E
, R
>>
Task
Task:
Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.
constructor
⊕ new Task(opts?: TaskOptions<E
, R
>): Task
Parameters:
Param
Type
Description
Optional
opts
TaskOptions<E
, R
>
Returns: Task
<Optional>
dataProxy
● dataProxy: DataProxy
<TaskData<E
, R
>>
<Optional>
job
● job: Job<E
, R
>
addListener
▸ addListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
cancel
▸ cancel(reason?: any
): void
Parameters:
Param
Type
Description
Optional
reason
any
Returns: void
done
▸ done(sessionId: string
, result?: R): void
Parameters:
Param
Type
Description
sessionId
string
-
Optional
result
R
-
Returns: void
emit
▸ emit(event: * string
| symbol
, ...args: *any
[]): boolean
Parameters:
Param
Type
event
string
| symbol
Rest
args
any
[]
Returns: boolean
error
▸ error(sessionId: string
, reason?: any
): void
Parameters:
Param
Type
Description
sessionId
string
-
Optional
reason
any
-
Returns: void
eventNames
▸ eventNames(): Array
< string
| symbol
>
Returns: Array
< string
| symbol
>
getMaxListeners
▸ getMaxListeners(): number
Returns: number
listenerCount
▸ listenerCount(type: * string
| symbol
*): number
Parameters:
Param
Type
type
string
| symbol
Returns: number
listeners
▸ listeners(event: * string
| symbol
*): Function
[]
Parameters:
Param
Type
event
string
| symbol
Returns: Function
[]
off
▸ off(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
on
▸ on(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
once
▸ once(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
prependListener
▸ prependListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
prependOnceListener
▸ prependOnceListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
rawListeners
▸ rawListeners(event: * string
| symbol
*): Function
[]
Parameters:
Param
Type
event
string
| symbol
Returns: Function
[]
removeAllListeners
▸ removeAllListeners(event?: * string
| symbol
*): this
Parameters:
Param
Type
Optional
event
string
| symbol
Returns: this
removeListener
▸ removeListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
reset
▸ reset(): void
Returns: void
restart
▸ restart(request?: E): Promise
<RunningJob<E
, R
>>
Parameters:
Param
Type
Description
Optional
request
E
Returns: Promise
<RunningJob<E
, R
>>
setMaxListeners
▸ setMaxListeners(n: number
): this
Parameters:
Param
Type
n
number
Returns: this
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Starts the task.
Parameters:
Param
Type
Description
Optional
request
E
-
Returns: Promise
<RunningJob<E
, R
>>
update
▸ update(sessionId: string
, progress: number
): void
Parameters:
Param
Type
Description
sessionId
string
-
progress
number
Returns: void
Index
Classes
Interfaces
Type aliases
Events
Type aliases
Job
Ƭ Job: function
Type declaration
▸(request?: E): R
| Promise
<R
>
Parameters:
Param
Type
Optional
request
E
Returns: R
| Promise
<R
>
TaskData
Ƭ TaskData: object
Type declaration
Optional
errors: []
Optional
progress: undefined
| number
Optional
request: E
Optional
result: R
Optional
sessionId: undefined
| string
Optional
timeout: Timeout
Events
Controllable
Controllable:
Methods for controlling a task params: TaskData
params: TaskData
cancel
▸ cancel(reason?: any
): void
Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.
Parameters:
Param
Type
Description
Optional
reason
any
Returns: void
reset
▸ reset(): void
Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.
If the task is running a job, the job is first cancelled (cancel()).
Returns: void
restart
▸ restart(request?: E): void
Resets the task (cancelling any running job) and starts it anew with the supplied request.
Parameters:
Param
Type
Description
Optional
request
E
Returns: void
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.
Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start
Parameters:
Param
Type
Description
Optional
request
E
Returns: Promise
<RunningJob<E
, R
>>
Task
Task:
Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.
constructor
⊕ new Task(opts?: TaskOptions<E
, R
>): Task
Parameters:
Param
Type
Description
Optional
opts
TaskOptions<E
, R
>
Returns: Task
<Optional>
animation
● animation: AnimOptions
<Optional>
dataProxy
● dataProxy: DataProxy
<TaskData<E
, R
>>
<Optional>
job
● job: Job<E
, R
>
addListener
▸ addListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
cancel
▸ cancel(reason?: any
): void
Parameters:
Param
Type
Description
Optional
reason
any
Returns: void
done
▸ done(sessionId: string
, result?: R): void
Parameters:
Param
Type
Description
sessionId
string
-
Optional
result
R
-
Returns: void
emit
▸ emit(event: * string
| symbol
, ...args: *any
[]): boolean
Parameters:
Param
Type
event
string
| symbol
Rest
args
any
[]
Returns: boolean
error
▸ error(sessionId: string
, reason?: any
): void
Parameters:
Param
Type
Description
sessionId
string
-
Optional
reason
any
-
Returns: void
eventNames
▸ eventNames(): Array
< string
| symbol
>
Returns: Array
< string
| symbol
>
getMaxListeners
▸ getMaxListeners(): number
Returns: number
listenerCount
▸ listenerCount(type: * string
| symbol
*): number
Parameters:
Param
Type
type
string
| symbol
Returns: number
listeners
▸ listeners(event: * string
| symbol
*): Function
[]
Parameters:
Param
Type
event
string
| symbol
Returns: Function
[]
off
▸ off(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
on
▸ on(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
once
▸ once(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
prependListener
▸ prependListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
prependOnceListener
▸ prependOnceListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
rawListeners
▸ rawListeners(event: * string
| symbol
*): Function
[]
Parameters:
Param
Type
event
string
| symbol
Returns: Function
[]
removeAllListeners
▸ removeAllListeners(event?: * string
| symbol
*): this
Parameters:
Param
Type
Optional
event
string
| symbol
Returns: this
removeListener
▸ removeListener(event: * string
| symbol
, listener: *function
): this
Parameters:
Param
Type
event
string
| symbol
listener
function
Returns: this
reset
▸ reset(): void
Returns: void
restart
▸ restart(request?: E): Promise
<RunningJob<E
, R
>>
Parameters:
Param
Type
Description
Optional
request
E
Returns: Promise
<RunningJob<E
, R
>>
setMaxListeners
▸ setMaxListeners(n: number
): this
Parameters:
Param
Type
n
number
Returns: this
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Starts the task.
Parameters:
Param
Type
Description
Optional
request
E
-
Returns: Promise
<RunningJob<E
, R
>>
update
▸ update(sessionId: string
, progress: number
): void
Parameters:
Param
Type
Description
sessionId
string
-
progress
number
Returns: void
Index
Classes
Interfaces
Type aliases
Events
Type aliases
Job
Ƭ Job: function
Type declaration
▸(request: E
): R
| Promise
<R
>
Parameters:
Param | Type |
---|---|
request | E |
Returns: R
| Promise
<R
>
LoadTask
Ƭ LoadTask: Task<MasterDetailData<E
, V
>, IndexedItem<V
>>
LoadTaskData
Ƭ LoadTaskData: TaskData<MasterDetailData<E
, V
>, IndexedItem<V
>>
TaskData
Ƭ TaskData: object
Type declaration
Optional
errors: []
Optional
progress: undefined
| number
Optional
request: E
Optional
result: R
Optional
sessionId: undefined
| string
Optional
timeout: Timeout
Events
Controllable
Controllable:
Methods for controlling a task params: TaskData
params: TaskData
cancel
▸ cancel(reason?: any
): void
Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.
Parameters:
Param | Type | Description |
---|---|---|
Optional reason | any |
Returns: void
reset
▸ reset(): void
Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.
If the task is running a job, the job is first cancelled (cancel()).
Returns: void
restart
▸ restart(request?: E): void
Resets the task (cancelling any running job) and starts it anew with the supplied request.
Parameters:
Param | Type | Description |
---|---|---|
Optional request | E |
Returns: void
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.
Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start
Parameters:
Param | Type | Description |
---|---|---|
Optional request | E |
Returns: Promise
<RunningJob<E
, R
>>
Task
Task:
Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.
constructor
⊕ new Task(opts: TaskOptions<E
, R
>): Task
Parameters:
Param | Type | Description |
---|---|---|
opts | TaskOptions<E , R > |
Returns: Task
<Optional>
animation
● animation: AnimOptions
<Optional>
dataProxy
● dataProxy: DataProxy
<TaskData<E
, R
>>
job
● job: Job<E
, R
>
addListener
▸ addListener(event: string
| symbol
, listener: function
): this
Parameters:
Param | Type |
---|---|
event | string | symbol |
listener | function |
Returns: this
cancel
▸ cancel(reason?: any
): void
Parameters:
Param | Type | Description |
---|---|---|
Optional reason | any |
Returns: void
done
▸ done(sessionId: string
, result?: R): void
Parameters:
Param | Type | Description |
---|---|---|
sessionId | string | - |
Optional result | R | - |
Returns: void
emit
▸ emit(event: string
| symbol
, ...args: any
[]): boolean
Parameters:
Param | Type |
---|---|
event | string | symbol |
Rest args | any [] |
Returns: boolean
error
▸ error(sessionId: string
, reason?: any
): void
Parameters:
Param | Type | Description |
---|---|---|
sessionId | string | - |
Optional reason | any | - |
Returns: void
eventNames
▸ eventNames(): Array
< string
| symbol
>
Returns: Array
< string
| symbol
>
getMaxListeners
▸ getMaxListeners(): number
Returns: number
listenerCount
▸ listenerCount(type: string
| symbol
): number
Parameters:
Param | Type |
---|---|
type | string | symbol |
Returns: number
listeners
▸ listeners(event: string
| symbol
): Function
[]
Parameters:
Param | Type |
---|---|
event | string | symbol |
Returns: Function
[]
off
▸ off(event: string
| symbol
, listener: function
): this
Parameters:
Param | Type |
---|---|
event | string | symbol |
listener | function |
Returns: this
on
▸ on(event: string
| symbol
, listener: function
): this
Parameters:
Param | Type |
---|---|
event | string | symbol |
listener | function |
Returns: this
once
▸ once(event: string
| symbol
, listener: function
): this
Parameters:
Param | Type |
---|---|
event | string | symbol |
listener | function |
Returns: this
prependListener
▸ prependListener(event: string
| symbol
, listener: function
): this
Parameters:
Param | Type |
---|---|
event | string | symbol |
listener | function |
Returns: this
prependOnceListener
▸ prependOnceListener(event: string
| symbol
, listener: function
): this
Parameters:
Param | Type |
---|---|
event | string | symbol |
listener | function |
Returns: this
rawListeners
▸ rawListeners(event: string
| symbol
): Function
[]
Parameters:
Param | Type |
---|---|
event | string | symbol |
Returns: Function
[]
removeAllListeners
▸ removeAllListeners(event?: string
| symbol
): this
Parameters:
Param | Type |
---|---|
Optional event | string | symbol |
Returns: this
removeListener
▸ removeListener(event: string
| symbol
, listener: function
): this
Parameters:
Param | Type |
---|---|
event | string | symbol |
listener | function |
Returns: this
reset
▸ reset(): void
Returns: void
restart
▸ restart(request?: E): Promise
<RunningJob<E
, R
>>
Parameters:
Param | Type | Description |
---|---|---|
Optional request | E |
Returns: Promise
<RunningJob<E
, R
>>
setMaxListeners
▸ setMaxListeners(n: number
): this
Parameters:
Param | Type |
---|---|
n | number |
Returns: this
start
▸ start(request?: E): Promise
<RunningJob<E
, R
>>
Starts the task.
Parameters:
Param | Type | Description |
---|---|---|
Optional request | E | - |
Returns: Promise
<RunningJob<E
, R
>>
update
▸ update(sessionId: string
, progress: number
): void
Parameters:
Param | Type | Description |
---|---|---|
sessionId | string | - |
progress | number |
Returns: void