I would like to set a property of a Constructorfunction inside a arrowfunction which is a property of the Constructorfunction. Inside the arrowfunction I want to use setTimeout(), which takes a function as argument. In my case a anonymous function.
Thanks in advance :)
function ConstructorFunction(){
this.statusOptions = {
idle : 'idle',
working : 'working'
};
this.status = this.statusOptions.idle;
this.setStatus = () => {
setTimeout(function(){
this.status = this.statusOptions.working;
}, 2000);
};
}
var instance = new ConstructorFunction();
instance.setStatus();