Created
January 11, 2014 07:53
-
-
Save anonymous/8368253 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
innitApp.provider('Waterline',function(){ | |
var _collections = [] | |
var _adapters = {} | |
var waterline = new Waterline() | |
return { | |
$get : function(){ | |
angular.forEach(_collections,function(_model){ | |
waterline.loadCollection(_model) | |
}) | |
console.log(_adapters) | |
waterline.initialize({adapters : _adapters},console.log.bind(console)) | |
return waterline; | |
}, | |
$adapter : function(adapter){ | |
angular.extend(_adapters,adapter) | |
}, | |
$collection : function(def){ | |
_collections.push(Waterline.Collection.extend(def)) | |
} | |
} | |
}) | |
innitApp.config(['WaterlineProvider',function(WaterlineProvider){ | |
//register an adapter w/ waterline provider | |
WaterlineProvider.$adapter({ | |
foobar: { | |
identity: 'foobar', | |
foobar: function(collectionName, options, cb) { | |
return cb(null, { | |
status: true | |
}); | |
} | |
} | |
}) | |
//register an adapter w/ waterline provider | |
WaterlineProvider.$collection({ | |
identity: 'cheesybread', | |
attributes: {}, | |
adapter: 'foobar', | |
schema: false | |
}) | |
}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment