diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/dwb-js.7 | 20 | ||||
-rw-r--r-- | api/jsapi.7.txt | 20 | ||||
-rw-r--r-- | api/jsapi.txt | 20 |
3 files changed, 33 insertions, 27 deletions
diff --git a/api/dwb-js.7 b/api/dwb-js.7 index 75ae3ac0..db781718 100644 --- a/api/dwb-js.7 +++ b/api/dwb-js.7 @@ -1337,17 +1337,19 @@ function foo(message) }); return d; } +function callback1(response) +{ + io\&.print(response); // Prints "foo" after 2 seconds -foo("foo")\&.done( - function(response) { - io\&.print(response); // Prints "foo" after 2 seconds + // Return a new Deferred, will replace the old one\&. + return foo("bar"); +} +function callback2(response) +{ + io\&.print(response); // Prints "bar" after 4 seconds +} - // Return a new Deferred, will replace the old one\&. - return foo("bar"); - })\&.done( - function(response) { - io\&.print(response); // Prints "bar" after 4 seconds - }); +foo("foo")\&.done(callback1)\&.done(callback2); .fi .if n \{\ .RE diff --git a/api/jsapi.7.txt b/api/jsapi.7.txt index 7d4fe753..3a2ca7cd 100644 --- a/api/jsapi.7.txt +++ b/api/jsapi.7.txt @@ -669,17 +669,19 @@ function foo(message) }); return d; } +function callback1(response) +{ + io.print(response); // Prints "foo" after 2 seconds -foo("foo").done( - function(response) { - io.print(response); // Prints "foo" after 2 seconds + // Return a new Deferred, will replace the old one. + return foo("bar"); +} +function callback2(response) +{ + io.print(response); // Prints "bar" after 4 seconds +} - // Return a new Deferred, will replace the old one. - return foo("bar"); - }).done( - function(response) { - io.print(response); // Prints "bar" after 4 seconds - }); +foo("foo").done(callback1).done(callback2); --------------------------------- diff --git a/api/jsapi.txt b/api/jsapi.txt index 7bd919ac..b04c583a 100644 --- a/api/jsapi.txt +++ b/api/jsapi.txt @@ -1243,17 +1243,19 @@ function foo(message) }); return d; } +function callback1(response) +{ + io.print(response); // Prints "foo" after 2 seconds -foo("foo").done( - function(response) { - io.print(response); // Prints "foo" after 2 seconds + // Return a new Deferred, will replace the old one. + return foo("bar"); +} +function callback2(response) +{ + io.print(response); // Prints "bar" after 4 seconds +} - // Return a new Deferred, will replace the old one. - return foo("bar"); - }).done( - function(response) { - io.print(response); // Prints "bar" after 4 seconds - }); +foo("foo").done(callback1).done(callback2); --------------------------------- |