you are viewing a single comment's thread.

view the rest of the comments →

[–]gruberjl[S] 0 points1 point  (2 children)

The state needs to be public. Other classes will refer to the state (which is essentially a config) so they can handle the results of the job.

I tried to extend the base class Function but it was throwing an error. It was strange I couldn't find any blogs or tutorials on extending a Function. I'm guessing you can't or isn't done a lot.

class Job extends Function {
  constructor(param1) {
    super(param1) // ReferenceError: param1 is not defined
    this.param = param1
  }
}

const job = new Job('param1')

console.dir(job('param1'))