Re: Web MIDI polyfill

On Sat, Dec 15, 2012 at 9:49 PM, Marcos Caceres <w3c@marcosc.com> wrote:

> On Friday, 14 December 2012 at 21:26, Chris Wilson wrote:
> > On Fri, Dec 14, 2012 at 7:06 AM, Marcos Caceres <w3c@marcosc.com(mailto:
> w3c@marcosc.com)> wrote:> > The way I've been doing it is to create a
> fake element:
> > >
> > > var dispatcher = document.createElement('x-eventDispatcher');
> > >
> > > then I wrap:
> > > dispatcher.addEventListener(…)
> > > dispatcher.removeEventListener(…)
> > > dispatcher.dispatchEvent(…)
> > >
> > > It then handles everything for me.
> > >
> > > You are correct that in this instance it does not matter about the DOM
> Tree. See the link above to see it in action.
> >
> > I still don't understand why this matters, given that it's not
> dispatching on a DOM element?
>


> True. Maybe it does not matter here.
>

I went through event dispatching, trying to find an example that wasn't
dispatching on a DOM element, and couldn't find one; after thinking through
the implications, I couldn't come up with a reason that building my own
would have negative implications, and it seemed much easier (and lower
overhead) than creating a fake element. I could easily be wrong, but I was
trying to think about it, at least.  :)

Received on Monday, 17 December 2012 19:29:20 UTC