Removes an attached function which is called before key input processing.
(static) removeBeforeKeydownHandler(handler) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
handler |
function | A function to be removed. |
Returns:
A boolean indicates whether success or not.
- Type
- boolean
Example
angular.module('myApp', ['caph.focus']).config(['focusControllerProvider', function(focusControllerProvider) {
var calledOnce = false;
var beforeHandler = function(context, controller) {
calledOnce = true;
console.log('before moving');
};
focusControllerProvider.addBeforeKeydownHandler(beforeHandler);
focusControllerProvider.addAfterKeydownHandler(function(context, controller) {
console.log('after moving');
if (!calledOnce) {
focusControllerProvider.removeBeforeKeydownHandler(beforeHandler);
console.log('remove handler');
}
});
}]);