Created
July 9, 2014 15:52
-
-
Save squallstar/6af06777f8f52203fa51 to your computer and use it in GitHub Desktop.
data wrapper
This file contains 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
Layer = | |
getCollections: (callback) -> | |
collections = db.extractCollections() | |
return callback(collections) if collections.length | |
API.getCollections | |
success: (data) -> | |
collections = db.saveAndGetCollections data | |
callback(collections) | |
error: -> | |
callback(null) | |
# Sample usage: | |
Layer.getCollections (collections) -> | |
console.log collections |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment