- registerHandler(jobType, callback, [serverIndex])
Register a job handler
- ControlHarness :
Object
Job control harness
Register a job handler
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
jobType | String |
The type of job to handle | |
callback | function |
The callback method, which takes 2 parameters | |
[serverIndex] | Number |
0 |
The optional server index, if multiple servers are used |
Example
registerHandler("jobType", (data, control) => {
control.setProgressMax(100);
control.setProgress(1);
// do something with `data`
return data.item + 1;
});
Job control harness
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
id | String |
The job ID |
progress | Number |
The job progress |
progressMax | Number |
The max progress |
type | String |
The job type |
ControlHarness.setProgress ⇒ ControlHarness
Set the current progress of the job
Kind: static property of ControlHarness
Returns: ControlHarness
- Self
Param | Type | Description |
---|---|---|
progress | Number |
The new progress value |
ControlHarness.setProgressMax ⇒ ControlHarness
Set the max progress for the job
Kind: static property of ControlHarness
Returns: ControlHarness
- Self
Param | Type | Description |
---|---|---|
max | Number |
The new max progress value |