W3C home > Mailing lists > Public > public-device-apis@w3.org > March 2011

Re: Question about System Information API

From: Cameron McCormack <cam@mcc.id.au>
Date: Fri, 18 Mar 2011 09:42:04 +1300
To: Mark Watson <watsonm@netflix.com>
Cc: public-device-apis@w3.org
Message-ID: <20110317204203.GG1187@wok.mcc.id.au>
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) { … } }.


Cameron McCormack ≝ http://mcc.id.au/
Received on Thursday, 17 March 2011 20:42:41 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:53:48 UTC