Re: [cssom-view] addMediumListener / removeMediumListener

On May 27, 2010, at 10:58 AM, Luiz Agostini wrote:

> 2010/5/27 Simon Fraser <smfr@me.com>
> On May 27, 2010, at 1:33 AM, Anne van Kesteren wrote:
> 
> I'm  a little concerned about using a BooleanCallback here. I agree that there's an issue where the serialized query may not match what was originally used to add the listener, but I think having some context in the callback is necessary. This allows people writing OOP JS to have a single object with a handleEvent() function which can act as a listener for multiple queries. This would be slightly easier if there were an easy way to re-serialize a query (i.e. to convert it to its canonical form) via some API.
> 
> I think that it can be done using JC closures.

JS is not the only programming language that will be using this APIs. Browser vendors often also compile DOM bindings for native code.

> 
> 
> A slightly hacky alternative would be for addMediumListener() to return a token (like setTimeout()) that can be used to identify which listener is it, and gets passed to the callback.
> 
> And maybe could be passed to removeQueryListener().

Indeed.

Simon

Received on Thursday, 27 May 2010 19:23:28 UTC