Re: Event handlers in RTCPeerConnection

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