Is there a built in way to make custom events in JavaScript natively? -


i playing around javascript little while ago, , irritated me couldn't create own event.

i've seen framework's built in (jquery, mootools, prototype. dojo doesn't weird because seems , laundry) , built own system creating , firing custom events.

it feels there should native way it. know how this/if can?

var dragevent = document.createevent("event"); dragevent.initevent("dragged", true, true); el.dispatchevent(dragevent); 

for official specs, see dom level 2 events. see createevent(), initevent() / initmouseevent() / inituievent(), , dispatchevent() @ mdc.

i use technique create custom drag , resize events communication on this sample page.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -