{"action":"opened","issue":{"url":"https://api.github.com/repos/hoodiehq/pouchdb-hoodie-api/issues/31","labels_url":"https://api.github.com/repos/hoodiehq/pouchdb-hoodie-api/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/hoodiehq/pouchdb-hoodie-api/issues/31/comments","events_url":"https://api.github.com/repos/hoodiehq/pouchdb-hoodie-api/issues/31/events","html_url":"https://github.com/hoodiehq/pouchdb-hoodie-api/issues/31","id":80265584,"number":31,"title":"add events","user":{"login":"gr2m","id":39992,"avatar_url":"https://avatars.githubusercontent.com/u/39992?v=3","gravatar_id":"","url":"https://api.github.com/users/gr2m","html_url":"https://github.com/gr2m","followers_url":"https://api.github.com/users/gr2m/followers","following_url":"https://api.github.com/users/gr2m/following{/other_user}","gists_url":"https://api.github.com/users/gr2m/gists{/gist_id}","starred_url":"https://api.github.com/users/gr2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gr2m/subscriptions","organizations_url":"https://api.github.com/users/gr2m/orgs","repos_url":"https://api.github.com/users/gr2m/repos","events_url":"https://api.github.com/users/gr2m/events{/privacy}","received_events_url":"https://api.github.com/users/gr2m/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-24T20:40:44Z","updated_at":"2015-05-24T20:40:44Z","closed_at":null,"body":"```js\r\nvar db = new PouchDB('dbname')\r\nvar api = db.hoodieApi()\r\n\r\nhoodie.store.on('add', function(object, options) {})\r\nhoodie.store.on('update', function(object, options) {})\r\nhoodie.store.on('remove', function(object, options) {})\r\nhoodie.store.on('change', function(eventName, object, options) {})\r\n\r\nhoodie.store.one('add', function(object, options) {})\r\nhoodie.store.off('add', handler)\r\n```\r\n\r\nEvents should be implemented using EventEmitter. See [implementation](https://github.com/hoodiehq/wip-hoodie-store-on-pouchdb/blob/master/lib/api.js#L493-L577) / [tests](https://github.com/hoodiehq/wip-hoodie-store-on-pouchdb/blob/master/tests/test.events.js#L15-L257) in https://github.com/hoodiehq/wip-hoodie-store-on-pouchdb\r\n\r\n- ignore sync / clear events\r\n- ignore scoping with `storeOptions.type`\r\n- Implementation should not bloat the code for modular usage:\r\n\r\n```js\r\nPouchDB.plugin({\r\n  add: require('pouchdb-hoodie-api/add')\r\n})\r\n```"}}