I want to call the function callMe() every 1000 ms. This works so far, but I cannot call another function out of callMe(). I get the following Error:
uncaught TypeError: this.sortTargets is not a function
My class variable:
private intervalId : any;
The code/functions
constructor () {
this.intervalId = setInterval(this.checkLabelConflicts, 1000);
}
private sortTargets() {
console.log("hello world");
}
private checkFunction() {
this.sortTargets();
}
Why am I not able to call other functions out of the intervaled function? I already tried to set the constructor to bottom of the code, it feels like this is a declaration missing error. If someone has another solution without setInterval (e.g. workers/threads?) you're welcome to explain it to me.
Happy monday