W3C home > Mailing lists > Public > public-webrtc@w3.org > September 2012

Re: Event handlers in RTCPeerConnection

From: Martin Thomson <martin.thomson@gmail.com>
Date: Fri, 28 Sep 2012 10:47:36 -0700
Message-ID: <CABkgnnVZJPYQ_SDY-KS1P6RkOWzzLb0feTTkZQ5i30+bcyb7_A@mail.gmail.com>
To: Adam Bergkvist <adam.bergkvist@ericsson.com>
Cc: Randell Jesup <randell-ietf@jesup.org>, "public-webrtc@w3.org" <public-webrtc@w3.org>
On 28 September 2012 01:58, Adam Bergkvist <adam.bergkvist@ericsson.com> wrote:
> 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.

Not "needs to be", just "can be".

EventHandler is just the default for a callback of the form:

   [TreatNonCallableAsNull]
   callback EventHandlerNonNull = any (Event event);
   typedef EventHandlerNonNull? EventHandler;

As opposed to Function, which is probably something like:

   callback Function = any (any... arguments);

This implies that if you wish to declare an onsomething event handler
that consumes an event with additional parameters you would have:

   interface MyInterface : EventTarget {
      attribute MyEventHandler? onsomething;
   };
   [TreatNonCallableAsNull]
   callback MyEventHandler = void (MyEvent e);
   interface MyEvent : Event {
      readonly attribute any myProperty;
   };

There is no ambiguity there.  One advantage is that it links a to b to c.

That said, there is a convention that has developed whereby this
linkage is performed in prose.  If that is the choice of the editors,
can I request that the linkage be added?

--Martin

p.s. I had to consult Travis Leithead to confirm this.  This is part
of the HTML5 black magic.
Received on Friday, 28 September 2012 17:48:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:17:33 UTC