lib/Queryable.js
function(table, limit, page, query, fields)
    {
        if (this._doneLoading)
            return;

        var _this = this;

        // Execute -- add orderBy and ascending?
        var args = [table, limit, page, query, fields];
        if (this._orderBy) {
            args.push(this._orderBy);
            args.push(this._ascending);
        }

        var p = this.dataService.query.apply(this.dataService.query, args)

        // Pack results back into <T> and add it to our _results array
        .then(function(results) {
            results.forEach(function(r) {
                var obj = new _this._T();
                _(r).each(function(value, key) {
                    obj[key] = value;
                });
                _this._results.push(obj);
            });

            // If we hit the last page
            if (results.length !== limit)
                _this._doneLoading = true;

            return _this._results;
        });

        return p;
    }
function(table, limit, page, query, fields)
    {
        if (this._doneLoading)
            return;

        var _this = this;

        // Execute -- add orderBy and ascending?
        var args = [table, limit, page, query, fields];
        if (this._orderBy) {
            args.push(this._orderBy);
            args.push(this._ascending);
        }

        var p = this.dataService.query.apply(this.dataService.query, args)

        // Pack results back into <T> and add it to our _results array
        .then(function(results) {
            results.forEach(function(r) {
                var obj = new _this._T();
                _(r).each(function(value, key) {
                    obj[key] = value;
                });
                _this._results.push(obj);
            });

            // If we hit the last page
            if (results.length !== limit)
                _this._doneLoading = true;

            return _this._results;
        });

        return p;
    }
function ( table , limit , page , query , fields ) { if ( this . _doneLoading ) return ; var _this = this ; // Execute -- add orderBy and ascending? var args = [ table , limit , page , query , fields ] ; if ( this . _orderBy ) { args . push ( this . _orderBy ) ; args . push ( this . _ascending ) ; } var p = this . dataService . query . apply ( this . dataService . query , args ) // Pack results back into <T> and add it to our _results array . then ( function ( results ) { results . forEach ( function ( r ) { var obj = new _this . _T ( ) ; _ ( r ) . each ( function ( value , key ) { obj [ key ] = value ; } ) ; _this . _results . push ( obj ) ; } ) ; // If we hit the last page if ( results . length !== limit ) _this . _doneLoading = true ; return _this . _results ; } ) ; return p ; }
Where the actual API call is fired off. Returns a promise for the eventual raw value from the API call
Where the actual API call is fired off . Returns a promise for the eventual raw value from the API call