From e546c944645580065fd7b8df7f2e048f11d26311 Mon Sep 17 00:00:00 2001 From: portix Date: Sat, 8 Dec 2012 00:07:55 +0100 Subject: Don't break a callback chain of a deferred if one callback function is missing --- api/dwb-js.7 | 12 ++++++------ api/jsapi.7.txt | 9 ++++----- api/jsapi.txt | 7 +++---- 3 files changed, 13 insertions(+), 15 deletions(-) (limited to 'api') diff --git a/api/dwb-js.7 b/api/dwb-js.7 index db781718..b3cc9a31 100644 --- a/api/dwb-js.7 +++ b/api/dwb-js.7 @@ -2,12 +2,12 @@ .\" Title: dwb-js .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.77.1 -.\" Date: 12/07/2012 +.\" Date: 12/08/2012 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "DWB\-JS" "7" "12/07/2012" "\ \&" "\ \&" +.TH "DWB\-JS" "7" "12/08/2012" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -1292,7 +1292,7 @@ foo()\&.fail(onResponse)\&.fail(onResponse); .RE .\} .sp -Note that if the deferred is rejected only the fail chain is called, when it is resolved only the done chain is called\&. It is not possible to mix up done and fail chain\&. +Note that if the deferred is rejected only the fail chain is called, when it is resolved only the done chain is called\&. .sp .if n \{\ .RS 4 @@ -1314,10 +1314,10 @@ function onResponse(response) io\&.print(response); } -// Will not be executed at all\&. -foo()\&.done(onResponse)\&.fail(onResponse); -// Only the first callback is executed +// Only the fail will be executed + foo()\&.fail(onResponse)\&.done(onResponse); +foo()\&.done(onResponse)\&.fail(onResponse); .fi .if n \{\ .RE diff --git a/api/jsapi.7.txt b/api/jsapi.7.txt index 3a2ca7cd..a0d223d4 100644 --- a/api/jsapi.7.txt +++ b/api/jsapi.7.txt @@ -631,8 +631,7 @@ foo().fail(onResponse).fail(onResponse); --------------------------------- Note that if the deferred is rejected only the fail chain is called, when it is -resolved only the done chain is called. It is not possible to mix up done -and fail chain. +resolved only the done chain is called. [source,javascript] --------------------------------- function foo() @@ -651,10 +650,10 @@ function onResponse(response) io.print(response); } -// Will not be executed at all. -foo().done(onResponse).fail(onResponse); -// Only the first callback is executed +// Only the fail will be executed + foo().fail(onResponse).done(onResponse); +foo().done(onResponse).fail(onResponse); --------------------------------- Changing the deferred in a callback chain: diff --git a/api/jsapi.txt b/api/jsapi.txt index b04c583a..cb411b95 100644 --- a/api/jsapi.txt +++ b/api/jsapi.txt @@ -1205,8 +1205,7 @@ foo().fail(onResponse).fail(onResponse); --------------------------------- Note that if the deferred is rejected only the fail chain is called, when it is -resolved only the done chain is called. It is not possible to mix up done -and fail chain. +resolved only the done chain is called. [source,javascript] --------------------------------- function foo() @@ -1225,9 +1224,9 @@ function onResponse(response) io.print(response); } -// Will not be executed at all. +// Only the fail will be executed + foo().done(onResponse).fail(onResponse); -// Only the first callback is executed foo().fail(onResponse).done(onResponse); --------------------------------- -- cgit v1.2.3