Re: CHANGE: Remove numeric constants from WebRTC API

Le mardi 10 janvier 2012 à 10:10 +0100, Harald Alvestrand a écrit :
> we instead use strings (possibly in 
> the special form of WebIDL enumerations, which are mapped to JavaScript 
> strings by the language binding.
>
> I'm therefore calling for the WG's consensus to do this change.
> It affects at least the following:
> 
> - MediaStreamTrack: readyState (LIVE, MUTE and ENDED)
> - PeerConnection: readyState, iceState and sdpState

While I generally support moving away from numerical constants toward
string enumerations, I think consistency with existing APIs is an
important goal as well; XMLHttpRequest uses the same readyState
property, but uses numerical constants:
http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html

Likewise, readyState on media elements use numerical values:
http://dev.w3.org/html5/spec/video.html#dom-media-readystate

So, I am uncomfortable with using string values for readyState
properties; internal consistency would then also suggest against them
for iceState and sdpState.

That being said, it's probably worth coordinating with the HTML and
WebApps Working Group on the topic, to determine if they're thinking of
providing a string-based equivalent to these properties.

Dom

Received on Friday, 13 January 2012 15:14:20 UTC