W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2013

Re: [whatwg] Polling APIs in JavaScript vs Callbacks

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Mon, 11 Feb 2013 23:28:06 -0800
Message-ID: <CABZUbM1ExTEcZaRsbbuVrFqYFugyHBkzpOM5MsJikbSZSuzmQA@mail.gmail.com>
To: Glenn Maynard <glenn@zewt.org>
Cc: Gregg Tavares <gman@google.com>, WHATWG <whatwg@lists.whatwg.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
On 2/11/13, Garrett Smith <dhtmlkitchen@gmail.com> wrote:

[...]
>
>  var listener = {
>   handleEvent : function(ev) { console.log(ev); },
>   quant : 40
>  };
> //  or even
>  function handleEvent (ev) { console.log(ev); }
>  handleEvent.quant = 40;
>
Second example should have been
 function listener(ev) { console.log(ev); }
 listener.quant = 40;

>  var booleanParametersSuck = false;
>
>  document.addEventListener("mousemove",  listener, booleanParametersSuck);


Also, for those unfamiliar with the standard specification of
EventListener, particularly with the second parameter being an Object
with a handleEvent property that is a Function:
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventListener
-- 
Garrett
Twitter: @xkit
personx.tumblr.com
Received on Tuesday, 12 February 2013 07:28:31 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:19 UTC