I have been attempting to implement the lodash function _.debounce for a DefineMap view-model method in canjs. Even after trying to do this within the init method, I am having trouble with properly referencing 'this' inside the debounced function:
export const ViewModel = DefineMap.extend({
init() {
this.myMethod = _.debounce(this.myMethod, 200)
},
myMethod() {
// cool stuff here
}
})
Any guidance on resolving this issue would be highly appreciated!