- From: <bugzilla@jessica.w3.org>
- Date: Tue, 25 Dec 2012 21:06:17 +0000
- To: public-audio@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20502 --- Comment #4 from Chris Wilson <cwilso@gmail.com> --- (In reply to comment #3) > (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). "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. >Also, > to set that up requires some minor gymnastics when you could just get it for > free from the event itself. Well, it's not totally "free" - because it would have to be set on the event object for each call then - but not very expensive, I suppose. > 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). Well, but this leads me to believe it's not a good idea, because it will encourage the use of adding things to the MIDIPort (to get back to your own code), and binding (in the rare case that you would need a pointer back to your objects that isn't just a function pointer). -- You are receiving this mail because: You are the QA Contact for the bug.
Received on Tuesday, 25 December 2012 21:06:18 UTC