javascript - How check if custom event was prevented -
in code need interact custom event after dispatched
// ... let customevent = new customevent('myevent', { bubbles: true, cancelable: true }); button.addeventlistener('click', function (e) { e.preventdefault(); otherelement.dispatchevent( customevent ); // @ point neeed // if ( customevent canceled or prevented ) { } });
how can check if has been prevented/canceled or solution "feedback" event?
lots of ways this. 1 way:
var iscanceled = !otherelement.dispatchevent(event);
Comments
Post a Comment