You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Unable to convert function with a 'this' parameter to function 'handlerFunction' with no 'this'. To fix, wrap in an arrow function, or declare with 'this: void'."
If use 'this: void' - blowOnSpace lost 'this', so bad variant.
If use arrow function - its works:
To save original callback address, callback must be save separate:
this.temp['somename']=(...args: any)=>{returnthis.blowOnSpace(...args)}addEventHandler('onClientKey',root,this.temp['somename'])//and then we canremoveEventHandler('onClientKey',root,this.temp['somename'])
So much code for simple operation...
I try make 'cahing method'
methodCache(callback: (...args: any)=>void){let name =`${callback}`if(!this.temp[name]){/** @noSelf */this.temp[name]=(...args: any)=>{returncallback.bind(this)(...args)}}returnthis.temp[name]}
Simple give class method to addEventHandler not working:
"Unable to convert function with a 'this' parameter to function 'handlerFunction' with no 'this'. To fix, wrap in an arrow function, or declare with 'this: void'."
If use 'this: void' - blowOnSpace lost 'this', so bad variant.
If use arrow function - its works:
But have 2 problems:
To save original callback address, callback must be save separate:
So much code for simple operation...
I try make 'cahing method'
and now its looks:
But now i want
methodCache
per class... mb any idea to make it more simple ?The text was updated successfully, but these errors were encountered: