I have two events
cy.on('mousedown touchstart', 'node', function (event) {
// start
});
cy.on('mouseover tapdragover', 'node', function (event) {
// end
});
The problem is that the second event is almost immediately fired since the first event was fired when the mouse is being pressed on a node and the second is fired when the mouse is over a node.
Is it possible to debounce
or defer
the action? I know the syntax is cytoscape.js
-specific, but I guess the regular possibilities of using debounce
and defer
apply.
I guess an easy solution would be to save a timestamp in the first event and check if endTime - startTime > threshold
in the second event.