Skip to content

Instantly share code, notes, and snippets.

@Sawtaytoes
Created May 3, 2019 06:24
Show Gist options
  • Save Sawtaytoes/6ad7b2ecd636a31892ce586b2751c78f to your computer and use it in GitHub Desktop.
Save Sawtaytoes/6ad7b2ecd636a31892ce586b2751c78f to your computer and use it in GitHub Desktop.
<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