W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2013

Re: How to represent at key-value map in WebIDL

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 13 Feb 2013 08:47:47 -0800
Message-ID: <CAAWBYDDwq3aH3zXsaeps8oA4ZYrRcM2Q_+rARbCd4LWnGK_6pQ@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
On Wed, Feb 13, 2013 at 7:17 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 2/13/13 10:06 AM, Adam Bergkvist wrote:
>> What is the correct way to represent a key-value map in WebIDL that is
>> to be returned from a function?
>
> Is this a key-value map with an unbounded set of possible keys?  If so,

If it's a bounded set of possible keys, on the other hand, it's fairly
simple, depending on how you'd like to implement it.

You can either define a dictionary that the method returns, which
translates into a plain JS object with the given keys, or define an
interface, which translates into an object of that class.

~TJ
Received on Wednesday, 13 February 2013 16:48:34 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:09 UTC