Last active
June 6, 2016 11:01
-
-
Save weargoggles/1ea72b72d5dca4d63f468279059a168b to your computer and use it in GitHub Desktop.
This file contains 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
const (action_type, delay) => store => next => { | |
let last = performance.now() - delay; | |
return action => { | |
let now; | |
if (action.type === action_type) { | |
now = performance.now(); | |
if (now - last > delay) { | |
last = now; | |
return next(action); | |
} else { | |
return null; | |
} | |
} | |
return next(action); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment