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: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 13 Feb 2013 10:17:52 -0500
Message-ID: <511BAEA0.90903@mit.edu>
To: public-script-coord@w3.org
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,

> 1) A regular JavaScript object. If so, is there anything from WebIDL i
> can use to describe that object?

Nothing, no.  You'd have to just describe it in prose.

This has come up a few times; it might be good to add a WebIDL type for 
this.

> 2) Define an interface with a getter T (DOMString propName) and describe
> in text the procedure to find out if propName is valid and how to order
> all names.

This would work too, yes.

Which one you want depends on how you want things like script changing 
the map to work...

-Boris
Received on Wednesday, 13 February 2013 15:18:25 UTC

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