I am trying to implement a throttle method inside a class that takes as the second argument some class properties but I can't access the class properties because this is undefined.
I have reproduced the code in a simpler manner to demonstrate the issue:
function someThrottleFunction(a, b) {
// doesn't really matter what is in here
}
class cname {
constructor(prop1) {
this.prop1 = prop1;
}
func = someThrottleFunction(() => {}, this.prop1.time);
}
let a = new cname({ time: 3000 });
you can see a live code error demo here: https://codesandbox.io/s/x7yqy933qq
Any suggestions on how to rewrite this in a working manner are greately appreciated.