W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2009

Re: [webidl] Callback confusion

From: Giovanni Campagna <scampa.giovanni@gmail.com>
Date: Wed, 29 Apr 2009 16:24:23 +0200
Message-ID: <65307430904290724n15d28f9cn6fa3f604fb99fba6@mail.gmail.com>
To: Max Froumentin <maxfro@opera.com>
Cc: public-webapps@w3.org
2009/4/29 Max Froumentin <maxfro@opera.com>:
> Hi,
>
> I'm confused with http://dev.w3.org/2006/webapi/WebIDL/#Callback
>
> It seems that it is not possible to write:
>
> t.addListener(function() { ... });
>
> without throwing a typeError when the callback is thrown. Does that mean that you can never write an IDL
> that will let you write foo(function() {...};) without errors, and that you can only write it as foo({ baz: function() {...}}); ?

It throws a TypeError if the interface expected by addListener is
[Callback=PropertyOnly], else it will work.

> Also, the code labeled /* 2 */ is not explained. Does that mean that that line does nothing?

It means that when it is a function but implements the interface
through property assignment, the function takes precedence when
converted to an host object.

> Cheers,
> Max.
>

Giovanni
Received on Wednesday, 29 April 2009 14:25:04 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:31 GMT