Q: d3.timer update dispatches multiple times I've changed an slider to parse JSON data with an start and end date to create a d3.js playback visualization.
My REPL:
https://svelte.dev/repl/69ede1e0f5a74f0c81a1213ce844b9f1 ( slider.svelte -> line 145 function: update() )
What happens is that once a value is rounded to a hour, it dispatches it. but 6-7 values round to the hour so it gets dispatched 6-7 times.
Is there a way to return the function if the hour was already dispatched?
I'm using Svelte
Regards,
Pepijn

A: You should be able store the already dispatched hours in an array or object and check that one before firing or handling the event.  It is rather hard to show with your example because there are a lot of other things going on.  If you can simplify it to the pure basics it would be easier.

A: I solved my problem by adding a variable named "lastDispatch", I set this to the startDate value. 
in my update function I wrapped the dispatch function in this check:
 if(lastDispatch.getHours() < roundMinutes(new Date(target)).getHours()) 

and before dispatching I overwrite the variable again 
lastDispatch = roundMinutes(new Date(target));

