{"_id":"podda","_rev":"7-985b5eace9879d3472cc3b437d59783d","name":"podda","description":"Simple Reactive DataStore for JavaScript","dist-tags":{"latest":"1.2.2"},"versions":{"1.0.0":{"name":"podda","version":"1.0.0","description":"Simple Reactive DataStore for JavaScript","repository":{"type":"git","url":"git+https://github.com/arunoda/podda.git"},"license":"MIT","scripts":{"prepublish":". ./.scripts/prepublish.sh","lint":"eslint src","lintfix":"eslint src --fix","testonly":"mocha --require .scripts/mocha_runner src/**/tests/**/*.js","test":"npm run lint && npm run testonly","test-watch":"npm run testonly -- --watch --watch-extensions js"},"devDependencies":{"babel-cli":"^6.14.0","babel-core":"^6.14.0","babel-eslint":"^6.1.2","babel-loader":"^6.2.5","babel-plugin-transform-runtime":"^6.15.0","babel-polyfill":"^6.13.0","babel-preset-react-app":"^0.2.1","chai":"^3.5.0","eslint":"^3.6.0","eslint-config-airbnb":"^12.0.0","eslint-plugin-import":"^1.16.0","eslint-plugin-jsx-a11y":"^2.2.2","mocha":"^3.0.2","sinon":"^1.17.6"},"dependencies":{"babel-runtime":"^6.11.6","eslint-plugin-react":"^6.6.0"},"main":"dist/index.js","engines":{"npm":"^3.0.0"},"gitHead":"876f4ef2cd6ef76013144fe9f4cd05770329d0f4","bugs":{"url":"https://github.com/arunoda/podda/issues"},"homepage":"https://github.com/arunoda/podda#readme","_id":"podda@1.0.0","_shasum":"2beca95a0f07fded000c1feb5c8693182775b23f","_from":".","_npmVersion":"4.0.0","_nodeVersion":"6.6.0","_npmUser":{"name":"arunoda","email":"arunoda.susiripala@gmail.com"},"dist":{"shasum":"2beca95a0f07fded000c1feb5c8693182775b23f","tarball":"https://registry.npmjs.org/podda/-/podda-1.0.0.tgz","integrity":"sha512-x5F1O7zFaLjtUWSzSoQpGawBP+U0N2U0cx8xJIauHs3T34Q+U4HZNpnrW5ZZC2DIONnouH1TECHImtFU1FmFvQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDCHIiyw6Gn+smsngks0n4+z1VpnErMXkVnmYMhTRHw2AIgaezLYgKqUkcg+6u8hXkDARIyxPfDFyYyIhHM+IkbG9M="}]},"maintainers":[{"name":"arunoda","email":"arunoda.susiripala@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/podda-1.0.0.tgz_1478598597760_0.05649993312545121"}},"1.1.0":{"name":"podda","version":"1.1.0","description":"Simple Reactive DataStore for JavaScript","repository":{"type":"git","url":"git+https://github.com/arunoda/podda.git"},"license":"MIT","scripts":{"prepublish":". ./.scripts/prepublish.sh","lint":"eslint src","lintfix":"eslint src --fix","testonly":"mocha --require .scripts/mocha_runner src/**/tests/**/*.js","test":"npm run lint && npm run testonly","test-watch":"npm run testonly -- --watch --watch-extensions js"},"devDependencies":{"babel-cli":"^6.14.0","babel-core":"^6.14.0","babel-eslint":"^6.1.2","babel-loader":"^6.2.5","babel-plugin-transform-runtime":"^6.15.0","babel-polyfill":"^6.13.0","babel-preset-react-app":"^0.2.1","chai":"^3.5.0","eslint":"^3.6.0","eslint-config-airbnb":"^12.0.0","eslint-plugin-import":"^1.16.0","eslint-plugin-jsx-a11y":"^2.2.2","mocha":"^3.0.2","sinon":"^1.17.6"},"dependencies":{"babel-runtime":"^6.11.6","eslint-plugin-react":"^6.6.0"},"main":"dist/index.js","engines":{"npm":"^3.0.0"},"gitHead":"02528e530268bcc65e9b2d6c4ac11f06570bc99d","bugs":{"url":"https://github.com/arunoda/podda/issues"},"homepage":"https://github.com/arunoda/podda#readme","_id":"podda@1.1.0","_shasum":"80a72cd6abff80193aa7eec2d9740ce5386ffe11","_from":".","_npmVersion":"4.0.0","_nodeVersion":"6.6.0","_npmUser":{"name":"arunoda","email":"arunoda.susiripala@gmail.com"},"dist":{"shasum":"80a72cd6abff80193aa7eec2d9740ce5386ffe11","tarball":"https://registry.npmjs.org/podda/-/podda-1.1.0.tgz","integrity":"sha512-vknUpRmWx6LA4vErh/ByhVz9jhC+yU1TScG6LgpcfJdNRNuzuK/JMPd0BePIB+U21NTg4C7ChFj6IeFqR7OyBA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFrmDKbYcZW80PKo+vohj4W3++2iO/gGn9pref7dUaOUAiEAvxQ1qMuF0APNOpEW61ottRyvr9ko5B6n6ei1K4yefRY="}]},"maintainers":[{"name":"arunoda","email":"arunoda.susiripala@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/podda-1.1.0.tgz_1478600548148_0.5384200024418533"}},"1.2.0":{"name":"podda","version":"1.2.0","description":"Simple Reactive DataStore for JavaScript","repository":{"type":"git","url":"git+https://github.com/arunoda/podda.git"},"license":"MIT","scripts":{"prepublish":". ./.scripts/prepublish.sh","lint":"eslint src","lintfix":"eslint src --fix","testonly":"mocha --require .scripts/mocha_runner src/**/tests/**/*.js","test":"npm run lint && npm run testonly","test-watch":"npm run testonly -- --watch --watch-extensions js"},"devDependencies":{"babel-cli":"^6.14.0","babel-core":"^6.14.0","babel-eslint":"^6.1.2","babel-loader":"^6.2.5","babel-plugin-transform-runtime":"^6.15.0","babel-polyfill":"^6.13.0","babel-preset-react-app":"^0.2.1","chai":"^3.5.0","eslint":"^3.6.0","eslint-config-airbnb":"^12.0.0","eslint-plugin-import":"^1.16.0","eslint-plugin-jsx-a11y":"^2.2.2","eslint-plugin-react":"^6.6.0","mocha":"^3.0.2","sinon":"^1.17.6"},"dependencies":{"babel-runtime":"^6.11.6","immutable":"^3.8.1"},"main":"dist/index.js","engines":{"npm":"^3.0.0"},"gitHead":"9d112fe3a72a59fa4c868a51713053d9747b9272","bugs":{"url":"https://github.com/arunoda/podda/issues"},"homepage":"https://github.com/arunoda/podda#readme","_id":"podda@1.2.0","_shasum":"9ad3e9eeb2d6d97441c974c33107229d75fdd1f5","_from":".","_npmVersion":"4.0.0","_nodeVersion":"6.6.0","_npmUser":{"name":"arunoda","email":"arunoda.susiripala@gmail.com"},"dist":{"shasum":"9ad3e9eeb2d6d97441c974c33107229d75fdd1f5","tarball":"https://registry.npmjs.org/podda/-/podda-1.2.0.tgz","integrity":"sha512-R1Ia6c+7cF9zh7tDxD53ALGLwb5/Fd9vfRWoaaIbb4FW+jVkG1hmTafSgC3ifYht0ZHnnbgz+D63J/DIKZnrJw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB6f9DmpX5E3pdlGGH9qOFgGcYJz7cDim704TE96nzRuAiBpZGW/Irty7bua6QFjKz1RohcKZPss8FnSWC6O71VkqA=="}]},"maintainers":[{"name":"arunoda","email":"arunoda.susiripala@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/podda-1.2.0.tgz_1478993786369_0.024087983882054687"}},"1.2.1":{"name":"podda","version":"1.2.1","description":"Simple Reactive DataStore for JavaScript","repository":{"type":"git","url":"git+https://github.com/arunoda/podda.git"},"license":"MIT","scripts":{"prepublish":". ./.scripts/prepublish.sh","lint":"eslint src","lintfix":"eslint src --fix","testonly":"mocha --require .scripts/mocha_runner src/**/tests/**/*.js","test":"npm run lint && npm run testonly","test-watch":"npm run testonly -- --watch --watch-extensions js"},"devDependencies":{"babel-cli":"^6.14.0","babel-core":"^6.14.0","babel-eslint":"^6.1.2","babel-loader":"^6.2.5","babel-plugin-transform-runtime":"^6.15.0","babel-polyfill":"^6.13.0","babel-preset-react-app":"^0.2.1","chai":"^3.5.0","eslint":"^3.6.0","eslint-config-airbnb":"^12.0.0","eslint-plugin-import":"^1.16.0","eslint-plugin-jsx-a11y":"^2.2.2","eslint-plugin-react":"^6.6.0","mocha":"^3.0.2","sinon":"^1.17.6"},"dependencies":{"babel-runtime":"^6.11.6","immutable":"^3.8.1"},"main":"dist/index.js","engines":{"npm":"^3.0.0"},"gitHead":"2f80c9952e847eb4b764b8deec8cdec12196d76d","bugs":{"url":"https://github.com/arunoda/podda/issues"},"homepage":"https://github.com/arunoda/podda#readme","_id":"podda@1.2.1","_shasum":"ea8d9d30a95eae9bdb736a52b2dc56fad5d21bd8","_from":".","_npmVersion":"4.0.0","_nodeVersion":"6.6.0","_npmUser":{"name":"arunoda","email":"arunoda.susiripala@gmail.com"},"dist":{"shasum":"ea8d9d30a95eae9bdb736a52b2dc56fad5d21bd8","tarball":"https://registry.npmjs.org/podda/-/podda-1.2.1.tgz","integrity":"sha512-cddrhARUM+JY9TcPDKJq96EnouieiXJTpeC2PfknYYhVWQGtw3Wj9wf7lTXijaP/J6QKj3eUxEIJ9xPQo/+jHg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBEywslGu2hGCdllxNGi5OUS/JA9wIpZVDeRwnH270hHAiEA2gYlewZUl+m0eAc2jodduAvy20hACeWLi3Jx6033BVM="}]},"maintainers":[{"name":"arunoda","email":"arunoda.susiripala@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/podda-1.2.1.tgz_1479004177443_0.6845768485218287"}},"1.2.2":{"name":"podda","version":"1.2.2","description":"Simple Reactive DataStore for JavaScript","repository":{"type":"git","url":"git+https://github.com/arunoda/podda.git"},"license":"MIT","scripts":{"prepublish":". ./.scripts/prepublish.sh","lint":"eslint src","lintfix":"eslint src --fix","testonly":"mocha --require .scripts/mocha_runner src/**/tests/**/*.js","test":"npm run lint && npm run testonly","test-watch":"npm run testonly -- --watch --watch-extensions js"},"devDependencies":{"babel-cli":"^6.14.0","babel-core":"^6.14.0","babel-eslint":"^6.1.2","babel-loader":"^6.2.5","babel-plugin-transform-runtime":"^6.15.0","babel-polyfill":"^6.13.0","babel-preset-react-app":"^0.2.1","chai":"^3.5.0","eslint":"^3.6.0","eslint-config-airbnb":"^12.0.0","eslint-plugin-import":"^1.16.0","eslint-plugin-jsx-a11y":"^2.2.2","eslint-plugin-react":"^6.6.0","mocha":"^3.0.2","sinon":"^1.17.6"},"dependencies":{"babel-runtime":"^6.11.6","immutable":"^3.8.1"},"main":"dist/index.js","engines":{"npm":"^3.0.0"},"gitHead":"3e9829e7b1aeb4e0ffc73c60a6b5f84dff3f53fe","bugs":{"url":"https://github.com/arunoda/podda/issues"},"homepage":"https://github.com/arunoda/podda#readme","_id":"podda@1.2.2","_shasum":"15b0edbd334ade145813343f5ecf9c10a71cf500","_from":".","_npmVersion":"4.0.0","_nodeVersion":"6.6.0","_npmUser":{"name":"arunoda","email":"arunoda.susiripala@gmail.com"},"dist":{"shasum":"15b0edbd334ade145813343f5ecf9c10a71cf500","tarball":"https://registry.npmjs.org/podda/-/podda-1.2.2.tgz","integrity":"sha512-LJ1GVMKJjEEK20ZKkmtt3TkeyyIW0wK2hEe7yN/tiVrXZ3YBTd6eG1nZbELLsLAK6GQ0Ry/zCRovq/PZRR0NeQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC6avmNG2CnRwXUJV5FU1x5Zi4fH28ljuY5SUm8Fxd6VgIgVoljfMpiFL6lVO57B2FRdAXqLV5V268cramgljuKB8A="}]},"maintainers":[{"name":"arunoda","email":"arunoda.susiripala@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/podda-1.2.2.tgz_1479339007562_0.9922614188399166"}}},"readme":"# Podda\n\nSimple Reactive DataStore for JavaScript.\n\nThis is a pure JavaScript in-memory key value store for your Single Page App.(SPA)\nYou can think this as a simple key value store with an event emitter.\n\nThis works [pretty well with React](#using-with-react) (as an simple substitute for Redux/MobX), but works with anything in JavaScript.\n\n## TOC\n<!-- TOC depthFrom:2 depthTo:2 withLinks:1 updateOnSave:0 orderedList:0 -->\n\n- [Installation](#installation)\n- [Sample Usage](#sample-usage)\n- [API](#api)\n- [Using with React](#using-with-react)\n\n<!-- /TOC -->\n\n## Installation\n\n```js\nnpm install --save podda\n```\n\n## Sample Usage\n\nLet's subscribe to the data store and set an item.\n\n```js\nimport Podda from 'podda';\n\nconst defaults = { 'race': 'Human' };\nconst store = new Podda(defaults);\n\n// Subscribe for changes\nconst stopSubscription = store.subscribe((data) => {\n  console.log('Data:', data);\n});\n\n// Set some items.\nstore.set('name', 'Arunoda'); // logs => Data: { name: 'Arunoda' }\nstore.set('age', 99); // logs => Data: { name: 'Arunoda', age: 99 }\n\n// stop the subscription\nstopSubscription();\nstore.set('city', 'Colombo'); // logs nothing.\n```\n\n**[Play with this example](#podda)**\n\n## API\n\nAssume we've an instance of Podda called store as defined follows:\n\n```js\nconst store = new Podda();\n```\n\n### set\n\nSet a value. Value could be anything which can be serialize to JSON.\n\n```js\nstore.set('key', 'value');\n```\n\n### get\n\nGet a value by the give key.\n\n```js\nstore.get('key');\n```\n\n### update\n\nUpdate multiple entries of the store at once. While updating, you could accept the current state of the store as well.\n\n```js\nstore.update(function(state) {\n  return {\n    newField: 10,\n    existingField: !Boolean(existingField)\n  };\n});\n```\n\n### getAll\n\nGet all the key values pairs in the store as a map.\n\n```js\nstore.getAll();\n```\n\n### subscribe\n\nSubscribe for the store and get an snapshot of the data of the whole store.\nRegistered callback will be fired for everything you set something to the store.\n\n```js\nconst stop = store.subscribe((data) => {\n  console.log('Data:', data);\n});\n\n// Stop the subscription when needed\nstop();\n```\n\nCall to this method return a function where you can use that to stop the subscription.\n\n### watch\n\nVery similar to subscribe but watch a given key instead of the all keys.\n\n```js\nconst stop = store.watch('name', (name) => {\n  console.log('Name is:', name);\n});\n\nstore.set('name', 'Arunoda'); // logs => Name is: Arunoda\nstore.set('age', 99); // logs nothing.\n```\n\n### watchFor\n\nVery similar to watch but watch for the value of the key as well.\n\n```js\nconst stop = store.watchFor('name', 'Arunoda', (name) => {\n  console.log('Name is:', name);\n});\n\nstore.set('name', 'Arunoda'); // logs => Name is: Arunoda\nstore.set('name', 'Matt'); // logs nothing\n```\n\n### fire\n\nThis will be pretty useful with the `watch` and `watchFor` APIs. You could simply fire those callback, without setting an item to the store. Hence, this has no effect on the `subscribe`.\n\n```js\nconst stop = store.watch('name', (name) => {\n  console.log('Name is:', name);\n});\n\nstore.set('name', 'Arunoda'); // logs => Name is: Arunoda\nstore.fire('name', 'Matt'); // logs => Name is: Matt\nconsole.log(store.get('name')) // logs => Arunoda\n```\n\n### registerAPI\n\nWith this, you'll be able to add new features to the store.\nFor an example, let's say we are using toggle functionality in our store a lot. So, we can add an API for that like this:\n\n```js\nstore.registerAPI('toggle', (store, key) => {\n  store.set(key, !store.get(key));\n  return store.get(key);\n});\n\n// Then we can use it like this:\nconsole.log('Toggled value for lights is:', store.toggle('lights'));\n```\n\n## Using with React\n\nIn order to use this with React, you need to get help from a data container. [React Komposer](https://github.com/arunoda/react-komposer) is an ideal tool for that.\n\nHave a look at [this example app](http://www.webpackbin.com/EJgu0ne-z).\n","maintainers":[{"name":"arunoda","email":"arunoda.susiripala@gmail.com"}],"time":{"modified":"2022-06-24T05:41:05.928Z","created":"2016-11-08T09:49:57.996Z","1.0.0":"2016-11-08T09:49:57.996Z","1.1.0":"2016-11-08T10:22:28.389Z","1.2.0":"2016-11-12T23:36:26.597Z","1.2.1":"2016-11-13T02:29:39.528Z","1.2.2":"2016-11-16T23:30:07.791Z"},"homepage":"https://github.com/arunoda/podda#readme","repository":{"type":"git","url":"git+https://github.com/arunoda/podda.git"},"bugs":{"url":"https://github.com/arunoda/podda/issues"},"license":"MIT","readmeFilename":"README.md"}