ACTION-135: Summarize the SuccessCallback patterns and use cases for each method (i.e. use Function or SuccessCallback(Message message))
Summarize the SuccessCallback patterns and use cases for each method (i.e. use Function or SuccessCallback(Message message))
- State:
- closed
- Person:
- Richard Tibbett
- Due on:
- March 25, 2010
- Created on:
- March 18, 2010
- Associated Product:
- APIs — General
- Related emails:
- Draft F2F Minutes Day 3, 2010-03-18 (from frederick.hirsch@nokia.com on 2010-03-18)
Related notes:
The use of [Callback=FunctionOnly] on the callback interfaces defined is explained clearly in the WebIDL specification @ http://dev.w3.org/2006/webapi/WebIDL/#Callback.
A method implementing these callbacks will accept a function. According to the WebIDL spec, the following are valid:
navigator.service.contacts.find("name", function() { /* success callback */} );
navigator.service.contacts.find("name", function(contacts) { /* success callback */} );
navigator.service.contacts.find("name", function(contacts) { /* success callback occurs here... */ onsuccess: function() { /* ...not here */ } } );
The following is not valid:
navigator.service.contacts.find("name", { onsuccess: function() { /* throws a TypeError */ } } );Richard Tibbett, 4 Oct 2010, 15:46:44
Display change log.