Re: About onaddtrack/onremovetrack

2015-05-13 8:35 GMT+02:00 Adam Bergkvist <adam.bergkvist@ericsson.com>:
> The reason you get a close event when you do close() on a WebSocket is
> because you initiate the closing handshake (state: CLOSING) and the
> event tells you when it's completed (state: CLOSED).
>
> I believe it's not common to fire events as a result of direct
> manipulation of objects.

RTCPeerConnection.close() fires "onsignalingstatechange" event
(pc.signalingState = closed). I don't think it's so uncommon.



> The task that fires an event is usually the
> task that modifies the concerned script objects and the reason for the
> event is to notify what happened. It's not compatible with a synchronous
> operation that performs its action directly.

I don't agree. Call close(), and react on the event listener. That is
very common in many libraries and APIs.




-- 
Iñaki Baz Castillo
<ibc@aliax.net>

Received on Monday, 18 May 2015 08:32:41 UTC