add callback to Ox.api
This commit is contained in:
parent
f3ff4b791d
commit
4b59c9a2a9
1 changed files with 4 additions and 1 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
/*@
|
||||
Ox.api <f> Turns an array into a list API
|
||||
<code>Ox.api</code> takes an array and returns a function that allows you to
|
||||
run complex queries against it. See the examples below for details.
|
||||
(items, options) -> <f> List API
|
||||
items <[o]> An array of objects (key/value stores)
|
||||
options <o> Options object
|
||||
|
@ -215,7 +217,7 @@ Ox.api = function(items, options) {
|
|||
return match;
|
||||
}
|
||||
|
||||
return function(options) {
|
||||
return function(options, callback) {
|
||||
var data,
|
||||
result = {data: {}, status: {code: 200, text: 'ok'}},
|
||||
sort = {};
|
||||
|
@ -278,6 +280,7 @@ Ox.api = function(items, options) {
|
|||
);
|
||||
}
|
||||
}
|
||||
callback && callback(result);
|
||||
return result;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue