Re: [WebIDL] Representing functions that user code can call

On 8/12/12 1:56 PM, Boris Zbarsky wrote:
> We have a way to represent user functions that platform objects can
> call: callbacks.
>
> But I don't think there's really a good way to represent functions that
> are not hanging off any particular object that user code can call.  Or
> can callbacks be used for that too?

Is this for

   partial interface Document {
     Function register(DOMString name, optional Options options);
   };

?  Despite the name "callback function", I think they could be used 
here.  I don't think there's anything in the spec that prevents platform 
objects from providing values of this type.

> Note that right now the web components spec is using callbacks for this,
> but they're not a great fit given how callback conversions between
> WebIDL and ES are defined...

What about the conversion is a bad fit?

> What's really wanted for this sort of use case is something closer to
> how Constructors are defined: basically a standalone WebIDL operation,
> not hanging off any object.

Maybe we could just rename callback functions to functions, and have 
them work both for user-provided and platform-object-provided Function 
values.

Received on Sunday, 9 December 2012 00:08:19 UTC