{"_id":"redux-subscriber","_rev":"5-243db3382809df92e582f192d697db6a","name":"redux-subscriber","description":"Subscribe to changes in any part of redux state","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"redux-subscriber","version":"1.0.0","description":"Subscribe to changes in any part of redux state","main":"lib/index.js","files":["lib"],"scripts":{"prepublish":"npm run clean && npm run lint && npm test && npm run build","clean":"rimraf lib","test:watch":"jest --watch","test:coverage":"jest --coverage && codecov","lint":"eslint index.js tests","build":"babel index.js -d lib"},"repository":{"type":"git","url":"git+https://github.com/ivantsov/redux-subscriber.git"},"keywords":["redux","store","state","subscribe","subscriber","watch","watcher","observe","observer","react"],"author":{"name":"Alexander Ivantsov","email":"alexivantsov@ya.ru","url":"https://github.com/ivantsov"},"license":"MIT","bugs":{"url":"https://github.com/ivantsov/redux-subscriber/issues"},"homepage":"https://github.com/ivantsov/redux-subscriber#readme","dependencies":{"object-path":"^0.11.3"},"devDependencies":{"babel-cli":"^6.18.0","babel-preset-es2015":"^6.18.0","codecov":"^1.0.1","eslint":"^3.11.1","eslint-config-airbnb-base":"^10.0.1","eslint-plugin-import":"^2.2.0","jest":"^17.0.3","rimraf":"^2.5.4"},"jest":{"testRegex":"tests/.*.js$","resetMocks":true,"resetModules":true},"gitHead":"40c2ad6af08b4bb0da44278305123c05122c07cc","_id":"redux-subscriber@1.0.0","_shasum":"bf77c738f20f2f3664d69d9907b7faf68e8217bc","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.1.0","_npmUser":{"name":"ivantsov","email":"alexivantsov@ya.ru"},"dist":{"shasum":"bf77c738f20f2f3664d69d9907b7faf68e8217bc","tarball":"https://registry.npmjs.org/redux-subscriber/-/redux-subscriber-1.0.0.tgz","integrity":"sha512-EKOxKn/ATre/E2W4XFDc5A1MnYmMOTGjzFLjP/+eHcWUeUjYVABINmU5hS2cYRQ1gZXA7yVyRz7AwQxKrnqTHQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBzHunp9aGdUvc/XvnxfUHOEQi8IELhXrfD18++pWb3MAiAfOLBDWlfyjAwPpZgFQ2l587hIVR4bft8V6XZksxm93g=="}]},"maintainers":[{"name":"ivantsov","email":"alexivantsov@ya.ru"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/redux-subscriber-1.0.0.tgz_1480618795268_0.2394833997823298"}},"1.1.0":{"name":"redux-subscriber","version":"1.1.0","description":"Subscribe to changes in any part of redux state","main":"lib/index.js","files":["lib"],"scripts":{"prepublish":"npm run clean && npm run lint && npm test && npm run build","clean":"rimraf lib","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage && codecov","lint":"eslint index.js tests","build":"babel index.js -d lib"},"repository":{"type":"git","url":"git+https://github.com/ivantsov/redux-subscriber.git"},"keywords":["redux","store","state","subscribe","subscriber","watch","watcher","observe","observer","react"],"author":{"name":"Alexander Ivantsov","email":"alexivantsov@ya.ru","url":"https://github.com/ivantsov"},"license":"MIT","bugs":{"url":"https://github.com/ivantsov/redux-subscriber/issues"},"homepage":"https://github.com/ivantsov/redux-subscriber#readme","dependencies":{"object-path":"^0.11.3"},"devDependencies":{"babel-cli":"^6.18.0","babel-preset-es2015":"^6.18.0","codecov":"^1.0.1","eslint":"^3.12.2","eslint-config-airbnb-base":"^11.0.0","eslint-plugin-import":"^2.2.0","jest":"^18.0.0","rimraf":"^2.5.4"},"jest":{"testRegex":"tests/.*.js$","resetMocks":true,"resetModules":true},"gitHead":"f9396497321900ccb47048db388235bf6f177e56","_id":"redux-subscriber@1.1.0","_shasum":"3cac28a674cec07b6e9e015ca7aabbbdac155543","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.2.0","_npmUser":{"name":"ivantsov","email":"alexivantsov@ya.ru"},"dist":{"shasum":"3cac28a674cec07b6e9e015ca7aabbbdac155543","tarball":"https://registry.npmjs.org/redux-subscriber/-/redux-subscriber-1.1.0.tgz","integrity":"sha512-oKZhXGm2nB3NsNCvJaXwRR4xXm1mlykA7yXikntrR+io7Bg6jQHE5B+KwzvBNZidDLMHypJrBUxyilTAtBk7cw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFz6/7MaJ6aPIessSt+TaYMLeO2hGBxSn7xTh9PjtWe/AiEA0lDZhj1MIhE9cbDJbCT6hkDspl4VpQOA8/KugGZr8dw="}]},"maintainers":[{"name":"ivantsov","email":"alexivantsov@ya.ru"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/redux-subscriber-1.1.0.tgz_1482009417300_0.7554620422888547"}}},"readme":"# redux-subscriber\n\n[![Build Status](https://travis-ci.org/ivantsov/redux-subscriber.svg?branch=master)](https://travis-ci.org/ivantsov/redux-subscriber)\n[![codecov](https://codecov.io/gh/ivantsov/redux-subscriber/branch/master/graph/badge.svg)](https://codecov.io/gh/ivantsov/redux-subscriber)\n[![npm version](https://badge.fury.io/js/redux-subscriber.svg)](https://badge.fury.io/js/redux-subscriber)\n\nThis package allows you to subscribe to changes in any part of [Redux](https://github.com/reactjs/redux) state.\n\n## Installation\n\n`npm install redux-subscriber --save`\n\n## Usage\n\n_store.js_\n```js\nimport {createStore} from 'redux';\nimport initSubscriber from 'redux-subscriber';\n\nconst store = createStore(...);\n\n// \"initSubscriber\" returns \"subscribe\" function, so you can use it\nconst subscribe = initSubscriber(store);\n```\n\n_somewhere-else.js_\n```js\n// or you can just import \"subscribe\" function from the package\nimport {subscribe} from 'redux-subscriber';\n\nconst unsubscribe = subscribe('user.messages.count', state => {\n    // do something\n});\n\n// if you want to stop listening to changes\nunsubscribe();\n\n```\n\n## Examples\n\n* https://github.com/ivantsov/yandex-mail-notifier-chrome - real app that uses `redux-subscriber`\n\n## API\n\n#### `initSubscriber(store)` (_default export_) - initialize `redux-subscriber`, so after that you can use `subscribe` method.\n\n#### Options\n\n- `store` - instance of Redux store.\n\nReturns `subscribe` function.\n\n#### `subscribe(key, callbackFunction)` - subscribe `callbackFunction` to changes.\n\n#### Options\n\n- `key` - string which specified the part of state (e.g. `user.message.count`) to listen to. \n- `callbackFunction` - function which will be called when the part of state has changed. New state is passed as a parameter.\n\nReturns `unsubscribe` function which can be called to unsubscribe from changes.\n","maintainers":[{"name":"ivantsov","email":"alexivantsov@ya.ru"}],"time":{"modified":"2022-06-26T10:29:21.436Z","created":"2016-12-01T18:59:57.257Z","1.0.0":"2016-12-01T18:59:57.257Z","1.1.0":"2016-12-17T21:16:57.970Z"},"homepage":"https://github.com/ivantsov/redux-subscriber#readme","keywords":["redux","store","state","subscribe","subscriber","watch","watcher","observe","observer","react"],"repository":{"type":"git","url":"git+https://github.com/ivantsov/redux-subscriber.git"},"author":{"name":"Alexander Ivantsov","email":"alexivantsov@ya.ru","url":"https://github.com/ivantsov"},"bugs":{"url":"https://github.com/ivantsov/redux-subscriber/issues"},"license":"MIT","readmeFilename":"README.md","users":{"nisimjoseph":true}}