couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jan Lehnardt (JIRA)" <j...@apache.org>
Subject [jira] Closed: (COUCHDB-368) Refactoring of jquery.couch.js
Date Tue, 21 Jul 2009 10:04:14 GMT

     [ https://issues.apache.org/jira/browse/COUCHDB-368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jan Lehnardt closed COUCHDB-368.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 0.10

Applied in in r796228.

> 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
>             Fix For: 0.10
>
>         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