[Web MIDI API] send(sequence<short> data)

If the first argument of send() is going to be coerced in to a Uint8Array, then send should just take any as a type. That avoids a whole bunch of unnecessary checks that will be performed when whatever value if thrown into new Uint8Array().  

For example:

send({}) === []
send(function(){}) === []
send(Node) === []  

send("") === [0]
send([" "]) === []

send([undefined,null,Node,Array, [1,23,432]]) === [0, 0, 0, 0, 0]

This one is important:
send(["100", "200", "300"])  === [100, 200, 44]


And so on…  

--  
Marcos Caceres
http://datadriven.com.au

Received on Monday, 24 December 2012 01:15:39 UTC