[Bug 20502] MIDIEvent should have a port attribute

https://www.w3.org/Bugs/Public/show_bug.cgi?id=20502

--- Comment #3 from Marcos Caceres <w3c@marcosc.com> ---
(In reply to comment #2)
> Can't you easily set this up by binding the onmessage handler?

It's probably not a good idea to use the onmessage handler because it can be
overridden by anyone (please also see issue at bottom of this reply). Also, to
set that up requires some minor gymnastics when you could just get it for free
from the event itself.

Like: 
var recording = []; 
for(....; i++){
midiaccess.getInputs()[i].addEventListener('message', function (e) {
  var instrument = {port: this, event: e};  
  recording.push(instrument);
  //or 
  e.port = this; 
  recording.push(e);
}); 

The second case above kinda sucks because it's not nice to add things to object
that you don't own (in this case a MIDIEvent). 

Actually, that brings up a separate issues I forgot to raise: is the MIDIAccess
object a singleton? As in: 

a = navigator.requestMIDIAccess();
b = navigator.requestMIDIAccess();

a === b? 

In the spec, this is currently unclear in 5.1.1:
"success: Let access be the MIDIAccess object for which access has been
granted."

Which kinda reads like the spec is assuming requestMIDIAccess() will not be
called repeatedly. 

Need to file a separate bug for the above, but some clarification would be
good.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 25 December 2012 21:00:32 UTC