- From: Marcos Caceres <marcos@marcosc.com>
- Date: Thu, 25 Sep 2014 19:09:57 -0400
- To: public-script-coord <public-script-coord@w3.org>
- Cc: Jeffrey Yasskin <jyasskin@google.com>
The Web BlueTooth API currently specifies interfaces that serve as lookup tables for values [1], which can lead to code that looks like this (extreme example): ``` //returns a UUID string navigator.bluetooth.uuids.catalytic_activity_concentration.katal_per_cubic_metre ``` Clearly, that's not ideal to type out. I'm wondering if anyone has some recommendations of how we can clean this up a bit. We've thrown around some ideas [2], like using a WebIDL [MapClass] to look up values using enums: ``` BluetoothUnitMap.get("katal_per_cubic_metre"); ``` or exposing things like the above as static constants on interface objects: ``` BluetoothUnitMap.catalytic_activity_concentration.katal_per_cubic_metre ``` ... but nothing feels quite right :/ Can anyone think of a better way of approaching this problem? Maybe it doesn't matter? [1] https://webbluetoothcg.github.io/web-bluetooth/#standard-gatt-units [2] https://github.com/WebBluetoothCG/web-bluetooth/issues/49
Received on Thursday, 25 September 2014 23:12:26 UTC