From 258e4e4b60c69c2d47369d15003cac863444b1d8 Mon Sep 17 00:00:00 2001 From: portix Date: Fri, 7 Dec 2012 18:36:07 +0100 Subject: Updated js-api --- api/dwb-js.7 | 20 +++++++++++--------- api/jsapi.7.txt | 20 +++++++++++--------- api/jsapi.txt | 20 +++++++++++--------- 3 files changed, 33 insertions(+), 27 deletions(-) (limited to 'api') 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); --------------------------------- -- cgit v1.2.3