Support additional parameters:
- Verify
type task is valid
- If no
id supplied name will be same as type
- If
id is supplied name will be id
initialContext will be supplied to the constructor as part of the context
|
async loadTask(name){ |
|
if(this.tasks[name]){ |
|
return |
|
} |
|
|
|
debug('loadTask', name, 'useNative =',this.useNative) |
|
|
|
let dt = new DeltaTime().start() |
|
|
|
|
|
"use strict" |
|
let task=null |
|
|
|
let TaskClass = null |
|
|
|
if(!this.useNative){ |
|
const build = Hoek.reach(this.service, `compiled.tasks.${name}`) |
|
TaskClass = eval(build.code/*, build.map*/) |
|
} |
|
else{ |
|
TaskClass = this.service.constructors.tasks[name] |
|
} |
|
|
|
task = new TaskClass({ |
|
context:{ |
|
party: this.party, |
|
serviceRunner: this |
|
} |
|
}) |
Support additional parameters:
typeidinitialContexttypetask is valididsuppliednamewill be same astypeidis suppliednamewill beidinitialContextwill be supplied to the constructor as part of thecontextdataparty-api/src/service/service-runner-node.js
Lines 84 to 112 in fc7be3f