You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Yoan Blanc (JIRA)" <ji...@apache.org> on 2009/05/30 12:59:07 UTC
[jira] Updated: (COUCHDB-368) Refactoring of jquery.couch.js
[ https://issues.apache.org/jira/browse/COUCHDB-368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yoan Blanc updated COUCHDB-368:
-------------------------------
Attachment: jquery.couch.js
COUCHDB-368.jquery.couch.js.patch
Patch and new file.
> Refactoring of jquery.couch.js
> ------------------------------
>
> Key: COUCHDB-368
> URL: https://issues.apache.org/jira/browse/COUCHDB-368
> Project: CouchDB
> Issue Type: Improvement
> Components: JavaScript View Server
> Affects Versions: 0.10
> Environment: {"couchdb":"Welcome","version":"0.10.0a780214"}
> Reporter: Yoan Blanc
> Priority: Minor
> Attachments: COUCHDB-368.jquery.couch.js.patch, jquery.couch.js
>
>
> When I dived into jquery.couch.js, I saw a lot of repetitions, I tried to refactor it a little bit, centralizing all (but one) $.ajax into one place (called ajax).
> Before:
> allDbs: function(options) {
> options = options || {};
> $.ajax({
> type: "GET", url: "/_all_dbs",
> complete: function(req) {
> var resp = $.httpData(req, "json");
> if (req.status == 200) {
> if (options.success) options.success(resp);
> } else if (options.error) {
> options.error(req.status, resp.error, resp.reason);
> } else {
> alert("An error occurred retrieving the list of all databases: " +
> resp.reason);
> }
> }
> });
> },
> After:
> allDbs: function(options) {
> ajax(
> {url: "/_all_dbs"},
> options,
> "An error occurred retrieving the list of all databases"
> );
> }
> Cheers,
> --
> Yoan
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.