diff options
-rw-r--r-- | api/jsapi.txt | 17 | ||||
-rw-r--r-- | src/js.h | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/api/jsapi.txt b/api/jsapi.txt index f6122dde..ac8a530d 100644 --- a/api/jsapi.txt +++ b/api/jsapi.txt @@ -1156,10 +1156,25 @@ _returns_;; A new deferred that can be used to chain callbacks. ==== *Examples* ==== -Simple usage of a deferred: +The builtin function system.spawn returns a deferred: [source,javascript] --------------------------------- +system.spawn("command").then( + function() + { + /* called when execution was successful */ + }, + function(errorcode) + { + /* called when execution wasn't successful */ + } +); +--------------------------------- + +Simple usage of a deferred: +[source,javascript] +--------------------------------- function loadUri(uri) { var d = new Deferred(); tabs.current.loadUri(uri, function(wv) { @@ -40,7 +40,7 @@ JSValueRef js_json_to_value(JSContextRef ctx, const char *text); JSValueRef js_context_change(JSContextRef, JSContextRef, JSValueRef, JSValueRef *); JSObjectRef js_value_to_function(JSContextRef, JSValueRef, JSValueRef *); -typedef struct _js_array_iterator { +typedef struct js_array_iterator_s { JSContextRef ctx; JSObjectRef array; int current_index; |