Re: [webidl] Callback confusion

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 UTC