W3C home > Mailing lists > Public > public-audio@w3.org > October to December 2012

[Web MIDI API] Examples and a serializer

From: Marcos Caceres <marcosscaceres@gmail.com>
Date: Sat, 15 Dec 2012 23:13:59 +0000
To: "public-audio@w3.org" <public-audio@w3.org>
Message-ID: <8C5F52830B2E47E0AE237FE7CD162265@gmail.com>
In "Getting Access to the MIDI System" and in "A Simple Loopback", it would be better if you just wrapped the code in a self invoking function. That way, you can avoid the whole discussion about avoiding globals:

…example here...

Also, please don't use if statements without curly braces… yes, it's part of JS, but every style guide recommends against doing this. It means code won't lint and can also lead to unforeseen errors.  

Lastly, the "Enumerating Inputs and Outputs" example makes a strong use case for adding either a serializer [1] to the MIDIPort interface. It would be nice if the object serialized into a JSON compatible structure (i.e., add toJSON compatibility). I think all that needs to be added to MIDIPort is:

serializer = { id, manufacturer, name, type, version};

[1] http://dev.w3.org/2006/webapi/WebIDL/#idl-serializers

Marcos Caceres
Received on Saturday, 15 December 2012 23:14:31 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:14 UTC