react-reveal
Version:
Really simple way to add reveal on scroll animation to your React app.
17 lines (14 loc) • 330 B
JavaScript
export default function throttle(callback, wait, context = this) {
let timeout = null
let callbackArgs = null
const later = () => {
callback.apply(context, callbackArgs)
timeout = null
}
return function() {
if (!timeout) {
callbackArgs = arguments
timeout = setTimeout(later, wait)
}
}
}