- From: Adam Bergkvist <adam.bergkvist@ericsson.com>
- Date: Fri, 28 Sep 2012 10:58:14 +0200
- To: Martin Thomson <martin.thomson@gmail.com>
- CC: Randell Jesup <randell-ietf@jesup.org>, "public-webrtc@w3.org" <public-webrtc@w3.org>
Hi
Each of the "onsomething" attributes needs to be generic EventHandler
attributes. To set such an event handler attribute is just one way to
register a listener for an event.
For example:
pc.onaddstream = myHandler;
is equivalent to using the EventTarget function addEventListener():
pc.addEventListener("addstream", myHandler, false);
It's up to prose to make clear which event type an event handler
attribute handles and which interface is used for that particular event.
Non-normative section 15 (Event summary) has a table that lists the
event name to interface type mappings. It's a convenience thing, it must
be possible to derive the same information from the normative parts.
/Adam
On 2012-09-26 23:18, Martin Thomson wrote:
> Section 14 does include some events, but the only linking between
> those and the classes that generate then is in prose.
>
> On 26 September 2012 13:41, Randell Jesup <randell-ietf@jesup.org> wrote:
>> On 9/26/2012 3:56 PM, Martin Thomson wrote:
>>>
>>> None of the event handlers for RTCPeerConnection have specific types
>>> associated with the event.
>>>
>>> This might be OK for the "stuff just happened events":
>>> attribute EventHandler onnegotationneeded;
>>> attribute EventHandler onopen;
>>>
>>> Each of the following produces an event that includes additional
>>> attributes:
>>> attribute EventHandler onicecandidate;
>>> - candidate : RTCIceCandidate
>>> attribute EventHandler onstatechange;
>>> - state : RTCPeerState
>>> attribute EventHandler onaddstream;
>>> - stream : MediaStream
>>> attribute EventHandler onremovestream;
>>> - stream : MediaStream ?
>>> attribute EventHandler ongatheringchange;
>>> - state : RTCGatheringState
>>> attribute EventHandler onicechange;
>>> - state : RTCIceState
>>> attribute EventHandler onidentityresult;
>>> - assertion : RTCIdentityAssertion
>>> - verified : boolean
>>
>>
>>
>> attribute EventHandler ondatachannel;
>> - channel: DataChannel
>>
>> onconnection, onclosedconnection: no params (and poorly named)
>>
>> In DataChannel objects:
>> onopen, onclose: no params
>> onerror: not defined yet - should try to mirror WebSockets
>> onmessage: Object (DOMString, Blob or ArrayBuffer) - same as WebSockets
>>
>>
>>
>>>
>>> Rather than using the generic EventHandler for each of these events, a
>>> specific, typed callback function for each these would make
>>> documentation easier. That callback would take a subclass of Event
>>> that included the extra attributes.
>>>
>>> Obviously, for some of these it could be just a matter of following
>>> through e.target.iceState or something like that, but others contain
>>> vital information. It would be nice if this could be more clearly
>>> documented.
>>>
>>> --Martin
>>>
>>
>>
>> --
>> Randell Jesup
>> randell-ietf@jesup.org
>>
>>
>
Received on Friday, 28 September 2012 08:58:45 UTC