Skip to content

loadTask - expand options #86

@sevenbitbyte

Description

@sevenbitbyte

Support additional parameters:

  • type
  • id
  • initialContext
  1. Verify type task is valid
  2. If no id supplied name will be same as type
  3. If id is supplied name will be id
  4. 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
}
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions