removeBeforeKeydownHandler

caph.focus.focusController. removeBeforeKeydownHandler

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']).controller('myController', ['$scope', 'focusController', function($scope, focusController) {
 	var calledOnce = false;
 
 	var beforeHandler = function(context) {
 		calledOnce = true;
 		console.log('before moving');
 	};
 
 	focusController.addBeforeKeydownHandler(beforeHandler);
 
 	focusController.addAfterKeydownHandler(function(context) {
 		console.log('after moving');
 		
 		if (!calledOnce) {
 			focusController.removeBeforeKeydownHandler(beforeHandler);
 			console.log('remove handler');
 		}
 	});
 }]);