Skip to content

Commit

Permalink
Deprecating finished in favor of complete.
Browse files Browse the repository at this point in the history
This is similar to how jQuery's `$.ajax()` function behaves.
  • Loading branch information
howardabrams committed May 21, 2012
1 parent e973849 commit 9c52b31
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
16 changes: 12 additions & 4 deletions web/js/jquery.fuzzytoast.js
Expand Up @@ -50,7 +50,9 @@
destination : $.fuzzytoast.default_destination,
method : $.fuzzytoast.default_method,
append : $.fuzzytoast.default_append,
before : $.fuzzytoast.default_before,
finished : $.fuzzytoast.default_finished,
complete : $.fuzzytoast.default_complete,
success : $.fuzzytoast.default_success,
parameters : parameters
}, $.fuzzytoast.linkdata[id]);
Expand Down Expand Up @@ -380,8 +382,11 @@
if (linkdata.success) {
linkdata.success(destination, linkdata.model);
}
if (linkdata.finished) {
linkdata.finished();
if (linkdata.finished) { // NOTE: This approach is obsolete and will
linkdata.finished(); // be removed in version 2.0
}
if (linkdata.complete) {
linkdata.complete();
}

// If the link contains a "refresh" tag, we will reget the
Expand Down Expand Up @@ -429,8 +434,11 @@
linkdata.error(errorDetails);
}

if (linkdata.finished) {
linkdata.finished();
if (linkdata.finished) { // NOTE: This approach is obsolete and will
linkdata.finished(); // be removed in version 2.0
}
if (linkdata.complete) {
linkdata.complete();
}
};

Expand Down
13 changes: 7 additions & 6 deletions web/templates/instructions.html
Expand Up @@ -87,18 +87,19 @@ <h2>Usage</h2>
</p>
</li>
<li><p>
<code>finished</code>
<code>complete</code>
- A function called after either the <code>success</code> or
<code>error</code> callbacks. Defaults to
<code>$.fuzzytoast.default_finished</code>
<code>$.fuzzytoast.default_complete</code>
</p>
</li>
<li><p>
<code>before</code>
- A callback function called before the requests for the template
and data have been made. It is passed the <code>destination</code>,
which allows a spinner to be inserted while the data is being
acquired.
acquired. Defaults to
<code>$.fuzzytoast.default_before</code>
<br/><br/>
If this function returns a function, that is passed to all
<code>$.ajax()</code> calls as a <code>beforeSend</code>
Expand Down Expand Up @@ -155,10 +156,10 @@ <h2>Usage</h2>
</p></li>
<li>
<p>
<code>$.fuzzytoast.default_finished</code>
<code>$.fuzzytoast.default_complete</code>
- A function name to be used for all
<code>finished</code>
requests.
<code>complete</code>d requests. Called after
any <code>success</code> or <code>error</code> calls.
</p></li>
<li>
<p>
Expand Down

0 comments on commit 9c52b31

Please sign in to comment.