Detect double click without click

I have an element with both a click and a separate dblclick behavior attached to it. When I double click though, I get both a click and double click event. Is it possible to disable the click event when a double click is detected? What would be the best way to achieve this? Currently I have:{  
  'click .myDiv'(event) {
  'dblclick .myDiv'(event) {
    console.log("double click");

Well, a double click is of course also click so if you think that your UI really needs that, specially for web pages, IMO rather confusing, interface you simply need make the click event aware that a doubleclick has taken over the responsibility to act on the users request

Since the click happens first you must either delay it’s actions until the timeout for a possible dbl click has passed. This you must do if the click loads a new template for instance, a template that would kill the dbl click relevance, or you must design your click activity in such a way that it can be aborted.

So, how to cancel the click event? There are many options, one would be a session variable set by the click event to hold the key to abort the click activity. The double click could then check for the presence of the key and run the abort method:


Note, add template to the event handler to get access to fucntions and variables your defined in template.onCreate or template.onRender

'dblclick .myDiv'(event, template) {
    console.log("double click");
1 Like

yes, i thought of something like this, but was wondering if there might be something built in that i was missing. I figure this is a common use case, many applications distinguish between single and double clicks. I will use this, thanks.