cwilso/WebMIDIAPIShim — pull request #56 by abudaan (2014-12-26 00:00:08+00:00)
Title: Shim updated according to the latest W3C draft

In short:

- the shim has been updated according to the latest draft: MIDIAccess.inputs and MIDIAccess.outputs are now objects that mimic MIDIInputMap resp. MIDIOutputMap
- added a class Iterator
- added a wrapper for Chromium's WebMIDI implementation
- moved the _requestMIDIAccess method to a self-invoking init method
- updated all examples
- added a new routing example
- replaced innerText with textContent in all examples
- updated the README according to the new WebMIDI API
- updated the link to the W3C WebMIDI API draft in the README file
- added link to new routing example in the README file

MIDIAccess.inputs and MIDIAccess.outputs are still implemented as functions in Chromium. Therefor I have also added a wrapper for Chromium's WebMIDI implementation, see the init method.

According to the new draft it should be possible to loop over inputs and outputs like so:

```
MIDIAccess.inputs.forEach(function(key, value){
console.log('input id:', key, ' input name:', value.name);
});
```

But in Chrome's WebMIDI implementation this doesn't work yet. The functionality is implemented in the shim and works correctly but to make the examples work with both the Jazz plugin and native WebMIDI, I have used the iterator in the web examples to loop over inputs and outputs:

```
var iterator = MIDIAccess.inputs.values();
var data;
while((data = iterator.next()).done !== true){
port = data.value;
console.log('input id:', port.id, ' input name:', port.name);
}
```