W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2016

Using objects for a mapping argument

From: Jeffrey Yasskin <jyasskin@google.com>
Date: Fri, 23 Sep 2016 18:23:05 -0700
Message-ID: <CANh-dXkjo4_1QNsGqqu-PcgqrrkGkh4mKjhirhiqJZZ5Qvk_+Q@mail.gmail.com>
To: public-script-coord <public-script-coord@w3.org>
Hi all, Tab and Anne suggested I ask about a use of objects here.

In https://api.csswg.org/bikeshed/?url=https://raw.githubusercontent.com/jyasskin/web-bluetooth-1/masked-data-prefixes/index.bs#device-discovery
defines some arguments to a function in which I want users to express
a map from integers or strings to a dictionary. One of the arguments
will look like {0x004C: {dataPrefix: [0x02, 0x15]}}, while the other
could be {0xFEAA: {dataPrefix: [0x10]}, "battery_service": {}}.

This is processed at
https://api.csswg.org/bikeshed/?url=https://raw.githubusercontent.com/jyasskin/web-bluetooth-1/masked-data-prefixes/index.bs#ref-for-dom-bluetoothlescanfilterinit-manufacturerdata-5
using explicit calls to `.[[OwnPropertyKeys]]()` and some other
ECMAScript operations.

Does this make sense, or should I have my users express these
arguments in some other way?

If this makes sense, would you like me to propose some WebIDL
operations that would make it easier?

Thanks,
Jeffrey
Received on Saturday, 24 September 2016 01:23:55 UTC

This archive was generated by hypermail 2.3.1 : Saturday, 24 September 2016 01:23:55 UTC