I have the following function:
onDocumentKeyUp: function (e) { if (e.keyCode === 27) { this.deactivate(); } }
I wanted to bind t
You can use .bind() to set the context (without immediately calling it like call or apply):
call
apply
$(document).on('keyup', this.onDocumentKeyUp.bind(this));
As this method is only supported by ES5.1-compliant browsers, you might use jQuery.proxy instead of polyfilling it.