How can I know in my triggering code that preventDefault
has been called?
$(document).trigger(\'customEvent\', params);
if (/* ??? */)
doDefault
In case someone needs it, as I did. Important the 2nd constructor-parameter:
Pure JS:
var event = new CustomEvent("close", { "cancelable": true });
// now event listeners can prevent default behavior
element.onclose(event);
// or: element.dispatchEvent(event);
if (!event.defaultPrevented)
defaultBehavior();