couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yoan Blanc (JIRA)" <j...@apache.org>
Subject [jira] Updated: (COUCHDB-368) Refactoring of jquery.couch.js
Date Sat, 30 May 2009 10:59:07 GMT

     [ 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.


Mime
View raw message