W3C home > Mailing lists > Public > public-audio@w3.org > October to December 2012

[Bug 20502] MIDIEvent should have a port attribute

From: <bugzilla@jessica.w3.org>
Date: Tue, 25 Dec 2012 23:11:04 +0000
To: public-audio@w3.org
Message-ID: <bug-20502-5429-jUDSF3S7Lm@http.www.w3.org/Bugs/Public/>

--- Comment #7 from Marcos Caceres <w3c@marcosc.com> ---
(In reply to comment #6)
> (In reply to comment #5)
> > > "Can't you easily set this up by binding the message handler (onmessage or
> > > addEventHandler function)?"  Binding is on the function object, irrelevant
> > > of onmessage or addEventHandler.
> > 
> > Maybe I'm not getting what you mean here. Are you literally saying use
> > .bind()? Or something else? 
> Yes, calling .bind.
> port.addEventListener( "message", myhandler.bind( myobj ) );

I honestly don't know how many people use or understand bind (I'm personally
often confused by it). I've personally have never have had to use it. That's
not to say that people don't use bind.

> > Oh, my example was supposed to be all bad - I'll see if I can come up with a
> > real usage scenario as I just made that on up on the spot. In any case, I
> > think we might be misunderstanding each other, but I can understand the need
> > for a good justification to adding this. 
> > 
> > I might need a stronger use case. At the moment, this might just fall into
> > the "nice to have" category. 
> I'm not fundamentally opposed, just want to ensure we have strong
> justification.

Agree. Would be good to hear if Jussi or others have a strong use case. 

> > I'll also be honest: I didn't know that "this" would become the port itself
> > before Jussi mentioned it. It makes sense, but I wonder if many developers
> > know about that.
> Hmm, noted.  Have to fix that in my shim, I think.

I added it the other day to my fork by doing something like:

function MIDIPort(...){
  var self = this;
  function (type, listener, useCapture) {
     dispatcher.addEventListener(type, function (e) {
        listener.call(self, e);
     }, useCapture);

You are receiving this mail because:
You are the QA Contact for the bug.
Received on Tuesday, 25 December 2012 23:11:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:15 UTC