jussi-kalliokoski / webmidi-issues

A test repo for importing the issues from bugzilla
0 stars 0 forks source link

send(sequence<short> data) should just be send(any data) #15

Open jussi-kalliokoski opened 11 years ago

jussi-kalliokoski commented 11 years ago

Originally reported on W3C Bugzilla ISSUE-20510 Mon, 24 Dec 2012 08:23:52 GMT Reported by Marcos Caceres Assigned to This bug has no owner yet - up for the taking

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…