Created
May 3, 2019 06:24
-
-
Save Sawtaytoes/6ad7b2ecd636a31892ce586b2751c78f to your computer and use it in GitHub Desktop.
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
<script> | |
let previousColor | |
let previousValue | |
let timeoutId | |
const queueUpdate = () => { | |
if ( | |
previousColor === color | |
&& previousValue === value | |
) { | |
return | |
} | |
previousColor = color | |
previousValue = value | |
clearTimeout(timeoutId) | |
timeoutId = ( | |
setTimeout( | |
() => addToQueue(id), | |
getRandomTimeout(), | |
) | |
) | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment