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

Question about System Information API

From: Mark Watson <watsonm@netflix.com>
Date: Thu, 17 Mar 2011 10:32:57 -0700
To: "public-device-apis@w3.org" <public-device-apis@w3.org>
Message-ID: <1766BE0A-90CF-4A66-A816-79ADE3BD455A@netflix.com>

The System Information API makes extensive use of callback objects and one thing about these is confusing me. The callback parameters have a custom type, such as SuccessCB, ErrorCB. These types are defined as having specific methods, such as onSuccess and onError.

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 ?

The model shown in the examples seem to be very much how one would want to program, perhaps more commonly using an anonymous function for the callback.

Apologies in advance if this is actually just an ECMAScript question!


Mark Watson
Received on Thursday, 17 March 2011 17:33:31 UTC

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