Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Wait to load action on typings
- let typingsTimeout = (callback, time) => {
- return () => {
- if(timeout) {
- clearTimeout(timeout);
- }
- timeout = setTimeout(() => {
- callback()
- }, time)
- };
- };
- /// use it like
- $(domElement).on('keypdown, keyup', typings(() => {
- // do action here
- }, 600));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement