cwilso / WebMIDIAPIShim

Polyfill using the Jazz NPAPI MIDI plugin to implement the Web MIDI API on Mac and Windows.
380 stars 53 forks source link

Automatically hide jazz plugin object #26

Closed jeremyfa closed 11 years ago

jeremyfa commented 11 years ago

I know we just have to add an html tag with id "MIDIPlugin" to the document, but it would be nice if the javascript itself was creating an hidden container automatically instead of having to add another HTML element manuallly.

I am thinking of doing something like this:

// Create hidden element
var el = document.createElement("div");
el.id = "MIDIPlugin";
el.style.position = "absolute";
el.style.visibility = "hidden";
el.style.left = "-9999px";
el.style.top = "-9999px";
document.body.appendChild(el);

// Add jazz object inside the hidden element
el.appendChild(o1);

Is there any reason not to do it?

Anyway thanks for this great work!

cwilso commented 11 years ago

Nope, not really any reason. I'd originally thought it would be a good idea to let the user do this, but I think it's probably best to default it and make it overridable. So - fixed by checkin: https://github.com/cwilso/WebMIDIAPIShim/commit/a31d478a59523906d842a9a3fa10f94d994d4f76. :)

jeremyfa commented 11 years ago

Great! :)