Dynamically set a Timer on any event, enable do-overs, even add cancel events dsone

There's this common task to fire an event when a user hovers the mouse over a certain element. Easily done, right?

But then there's this particular change request to fire the event with a certain delay. Like zoom in on an image, or open a tooltip, or a popup with more information only if a certain amount of time passed and only if the user does not move the mouse away or fires another particular event.

Nothing too complicated for sure, but isn't there a more general, reusable way of dealing with something like this? Hm...

  Creative Commons License
Algorithm Timer Events