Re: Question about System Information API

Hi Mark.

Mark Watson:
> However, in the examples, such as the example in 4.4, a function
> "success" is defined and it is this function that is supplied as the
> argument (in this case to the monitor method).
>
> How is it that the success function is compliant to the SuccessCB
> interface, which has the method onSuccess ?

It is due to the interfaces being defined like this:

  [Callback=FunctionOnly, NoInterfaceObject]
  interface SuccessCB {
    void onSuccess(optional Object obj);
  };

The [Callback] indicates that the object may be implemented by user
script.  That would be sufficient to allow a Function object to be
passed as a SuccessCB.  The FunctionOnly part disallows passing an
object { onSuccess: function(obj) { … } }.

http://dev.w3.org/2006/webapi/WebIDL/#Callback

-- 
Cameron McCormack ≝ http://mcc.id.au/

Received on Thursday, 17 March 2011 20:42:41 UTC