Skip to content

Instantly share code, notes, and snippets.

@squallstar
Created July 9, 2014 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save squallstar/6af06777f8f52203fa51 to your computer and use it in GitHub Desktop.
Save squallstar/6af06777f8f52203fa51 to your computer and use it in GitHub Desktop.
data wrapper
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