I have a series of Promises that I've written inside of a class:
class Executor {
someFunction(){
return Promise.resolve(function(){
console.log(this.name);
});
};
someOtherFunction(){
return Promise.resolve(function(){
console.log(this.date);
});
};
execute(){
let {someFunction, someOtherFunction} = this;
this.name = "John";
this.date = "Saturday";
someFunction=someFunction.bind(this)
someFunction().then(someOtherFunction.bind(this));
}
}
that I then invoke by instantiating the class and running the execute
method:
var e = new Executor;
e.execute();
Is there a better way to bind the context of the class to multiple functions rather than writing multiple bind()
statements?