Forked from davidstump/gist:d0b9f87f6a132c2991fb
Last active
August 29, 2015 14:06
-
-
Save kapusta/937f68910985ec7e5372 to your computer and use it in GitHub Desktop.
a keyup debouncing directive, needs to be decaffeinated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@App.directive "onDelayedKeyup", ['$timeout', ($timeout) -> | |
(scope, element, attrs) -> | |
timer = false | |
element.bind "keyup", -> | |
$timeout.cancel(timer) if timer | |
timer = $timeout -> | |
scope.$apply attrs.onKeyup | |
, 500 | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment