Element.click & element.dblclick events added in a element

hi there,
I am add two events on elements element.click and elment.dblclick,how to invoke dblclick and not invoke click?
thanks.

hello @maxwell-git,

you can listen to ‘element.click’ and/or ‘element.dblclick’ through the eventBus, like the following:

eventBus.on('element.dblclick', function(event) {
  // do something
});

You can take a look inside interaction-events module for which other events can be listened to through the eventBus.

Cheers,
Ricardo

Thanks for your reply, but may be I did not say clearly what I mean, I want to know eventBus loads at the same time ‘elment.click’ and ‘element.dblclick’, how to double-click executes only double click event and will not execute the click event?

‘element.dblclick’ is only triggered when there is a double click.

Cheers,
Ricardo

You cannot invoke only one of them. This is general to the click handling in all browsers.

If you’d like to make sure click does not get fired, roll your own click event and fire that only if a dblclick has not occured after a certain delay (most libraries trying to do that assume 300ms here).

1 Like

thanks .I see.
I resolve this problem in another way

Hello,
Can you please share with us that solution for the problem of stopping the click event when boubleClick fired?
Thanks