I understood how to create events, like that:
var evt=document.createEvent('Event');
evt.initEvent('foo',true,true);
window.dispatch(evt);
Then anyone can write : window.addEventListener("foo",myFunc,false); (just for safari)
But I didn’t understand where I define the tests of the event foo. For exemple, if the event is shake, where do I write the tests if the iPhone is shaked or not?
okay, it’s :
I thought we always had to write
and then