Improving AngularJS Simple Factory - wrapper around PhoneGap Storage API

后端 未结 2 482
面向向阳花
面向向阳花 2021-01-15 03:24

i am trying to do something \"nice\" in AngularJS with my so-so JS skills and i would like to hear how would you feel or improve/refactor following:

angular.         


        
2条回答
  •  北荒
    北荒 (楼主)
    2021-01-15 03:58

    http://rburns.paiges.net/about/ anwers following:

    function getCategories(){
      return promisedQuery('SELECT * FROM CATEGORIES', defaultResultHandler, defaultErrorHandler);
    }
    
    function getDishes(){
      return promisedQuery('SELECT * FROM DISHES', defaultResultHandler, defaultErrorHandler);
    }
    
    function defaultResultHandler(deferred) {
      return function(tx, results) {
        var len = results.rows.length;
        var output_results = [];
    
        for (var i=0; i

提交回复
热议问题