timse / hoodie.js

hoodie super power to the frontend!

Home Page:http://hoodiehq.github.com/hoodie.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

hoodie ✪ power to the frontend!

hoodie is a JavaScript library that runs in your browser. It gives you

  • user authentication
  • data storage and sync
  • sharing
  • emails
  • and so much more

And this is what it looks like:

  //
  // user authentication & more
  //
  hoodie.account.signUp('joe@example.com', 'secret')
  hoodie.account.signIn('joe@example.com', 'secret')
  hoodie.account.changePassword('secret', 'new_secret')
  hoodie.account.changeUsername('secret', 'newusername')
  hoodie.account.signOut()
  hoodie.account.resetPassword('joe@example.com')

  //
  // store data (it will sync to whereever your users sign in)
  //
  hoodie.store.add('task', {title: 'build sweetMasterApp tomorrow.'})
  hoodie.store.findAll('task')
  hoodie.store.update('task', '123', {done: true})
  hoodie.store.remove('task', '123')

  hoodie.store.on('add:task', function(object) {
    alert('new Task added: ' + object.task)
  })

  //
  // publish & share data
  //
  hoodie.store.findAll('task').publish()
  hoodie.user( username ).findAll()

  hoodie.store.find('task', '456').share()
  hoodie.share(shareId).findAll()
  hoodie.share(shareId).subscribe()

  //
  // sending emails … yep.
  //
  var magic = hoodie.email.send({
    to      : ['susan@example.com'],
    cc      : ['bill@example.com'],
    subject : 'rule the world',
    body    : 'we can do it!\nSigned, Joe'
  })

  magic.done( function(mail) {
    alert('Mail has been sent to ' + mail.to)
  })

  magic.fail( function(eror) {
    alert('Sory, but something went wrong: ' + error.reason)
  })

  // Like what you see? Good. Because we got more:
  // http://hoodiehq.github.com/hoodie.js
  // API DOCS: http://hoodiehq.github.com/hoodie.js/doc/hoodie.html

But … how does it work?

It's magic, stupid!™

Every app gets its own hoodie. You need to set one up, because that's whereTheMagicHappens:

  <script src="hoodie.js"></script>
  <script>
    whereTheMagicHappens = 'https://yourapp.hood.ie';
    hoodie = new Hoodie(whereTheMagicHappens);
  </script>

You can get a hoodie for your app with only a few clicks over on hood.ie.

If you like to host the magic yourselves, there you go.

Dependencies

hoodie borrows some functionality from jQuery, but we plan to remove this dependency soon.

Feedback

If you have any kind of feedback, especially regarding hoodie's API, please let us know. You can also find us on Twitter: @hoodiehq

Contribute

Want to join the revolution? Here's a quickstart for developers

License & Copyright

© 2012 Gregor Martynus Licensed under the Apache License 2.0.

About

hoodie super power to the frontend!

http://hoodiehq.github.com/hoodie.js/

License:Apache License 2.0


Languages

Language:JavaScript 95.7%Language:CSS 4.3%