Re: Web MIDI polyfill

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:
> > So, here is my rewrite of how I think it should work (not done, but working nicely in Chrome):
> > https://github.com/marcoscaceres/WebMIDIAPIShim/blob/gh-pages/WebMIDIAPI.js  
> >  
> > (note that I've changed the API a bit … now I need to sell you and the Web Audio WG on the changes :) )
>  
>  
> It's going to take me a lot longer to fully grok this, and think through the changes. One thing I did spot - if I read this correctly, you're just hashing the name as an id. That won't work in common scenarios - many users will have more than one of the same device (two identical controllers, or two or more of the same MIDI hardware interfaces). You really have to hash the index of the port in with it, or at least the index of ports-with-the-same-name.
Good point. I hadn't given that much thought yet to be honest.   

> > It still needs some further integration with WebIDL's error handling. The only guidance I could give you is to try to follow the WebIDL spec (yes, WebIDL is fairly illegible … we need to fix that as a larger community).
> "Fairly" is charitable. :)

I've raised issues about the legibility of that spec (given that it's fundamental to the Web), but no one else seems to want to raise it as a serious issue. If you honestly have trouble with it, I encourage your to email: public-script-coord@w3.org.  
  
>  
> > 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.  

> > This is going to be sooooo awesome if it gets implemented in browsers :)
>  
> WHEN. Power of positive thinking.
>  

Right!   

Received on Sunday, 16 December 2012 07:50:21 UTC