javascript - new Event('build') vs new CustomEvent('build') -
on mdn page creating , triggering events shows example of creating event event or customevent. explains customevent allows custom details, other that, doesn't much.
so, difference? if i'm creating generic scroll event, should use customevent? or events not exist in javascript?
also, noticed mouseevent child of event, if i'm creating click event, can use new mouseevent('click')?
thanks
from guide:
to add more data event object,
customeventinterface exists ,detailproperty can used pass custom data.
you can use event() anything. if want attach custom data, use customevent('eventname', {data}).
and yes, mouse-events, should use mouseevent.
Comments
Post a Comment