Created
May 3, 2019 06:25
-
-
Save Sawtaytoes/e9de9408384694370e61d0caf3603a2b 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
let previousColor | |
let previousValue | |
let timeoutId | |
const queueUpdate = () => { | |
if ( | |
previousColor === color | |
&& previousValue === value | |
) { | |
return | |
} | |
$$invalidate('previousColor', previousColor = color) | |
$$invalidate('previousValue', previousValue = value) | |
clearTimeout(timeoutId) | |
$$invalidate('timeoutId', timeoutId = ( | |
setTimeout( | |
() => addToQueue(id), | |
getRandomTimeout(), | |
) | |
)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment