var hoodie = new Hoodie()
If the Hoodie server is running on a different domain:
var hoodie = new Hoodie('https://example.com')
All methods return a promise.
hoodie.store.add(type, properties)
hoodie.store.find(type, id)
hoodie.store.findAll(type)
hoodie.store.update(type, id, changedProperties)
hoodie.store.updateAll(type, changedProperties)
hoodie.store.remove(type, id)
hoodie.store.removeAll(type, id)
hoodie.store.findOrAdd(type, id, properties)
hoodie.store.addOrUpdate(type, id, properties)
// find out if user is signed in
if (hoodie.account.username) { /* ... */ }
All methods return a promise.
hoodie.account.signUp(username, password)
hoodie.account.signIn(username, password)
hoodie.account.signOut()
hoodie.account.destroy()
hoodie.account.resetPassword(username)
// returns a unique id for the current user,
// independent of whether user has account or not
hoodie.id()
// send custom requests, type being 'GET', 'POST', etc
hoodie.request(type, path, options)
// work with remote store
var remoteStore = hoodie.open(dbName)
// remoteStore has same API as hoodie.store
hoodie.on('disconnected', function() {})
hoodie.on('reconnected', function() {})
hoodie.store.on('change', function(eventName, object) {})
hoodie.store.on('add', function(object) {})
hoodie.store.on('update', function(object) {})
hoodie.store.on('remove', function(object) {})
// store change/add/update/remove events can be namespaced
hoodie.store.on('type:change', function(eventName, object) {})
hoodie.store.on('type:id:change', function(eventName, object) {})
hoodie.store.on('clear', function(){})
hoodie.account.on('signup', function(username){})
hoodie.account.on('signin', function(username){})
hoodie.account.on('signout', function(username){})