{"_id":"@atayahmet/observer-js","_rev":"2-1c0e1138831525a35023a6ea9f7aed5b","name":"@atayahmet/observer-js","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.1-alpha.1":{"name":"@atayahmet/observer-js","version":"0.0.1-alpha.1","description":"Observer js created based on observer pattern criteria. Create subjects and add it callback as observer.","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"test":"cross-env NODE_ENV=test && jest --config jestconfig.json --no-cache","coverage":"nyc report --reporter=text-lcov | coveralls","build":"tsc","format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"tslint -p tsconfig.json","prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint","version":"npm run format && git add -A src","postversion":"git push && git push --tags"},"repository":{"type":"git","url":"git+https://github.com/atayahmet/observer-js.git"},"keywords":["observer","subject","async","sub","pub"],"author":{"name":"Ahmet ATAY"},"license":"MIT","bugs":{"url":"https://github.com/atayahmet/observer-js/issues"},"homepage":"https://github.com/atayahmet/observer-js#readme","devDependencies":{"@types/jest":"^24.0.9","cross-env":"^5.2.0","jest":"^24.3.1","prettier":"^1.16.4","ts-jest":"^24.0.0","tslint":"^5.13.1","tslint-config-prettier":"^1.18.0","typescript":"^3.3.3333"},"directories":{"lib":"lib"},"dependencies":{},"gitHead":"6e3941cea8beec47ff553c3992df142e68367b13","_id":"@atayahmet/observer-js@0.0.1-alpha.1","_nodeVersion":"12.14.0","_npmVersion":"6.13.7","dist":{"integrity":"sha512-0LryL9cd0MG070ezjkHiUErb3WN56ncskQ7Sv2K27Rdo5L+u/Zn0JssRd5tCcD2ptmrv8evxxx6tmFCJ/Zfx2A==","shasum":"95c3ebce6040b024d70d5f2044bfb15be3d0724f","tarball":"https://registry.npmjs.org/@atayahmet/observer-js/-/observer-js-0.0.1-alpha.1.tgz","fileCount":5,"unpackedSize":11859,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeTCqyCRA9TVsSAnZWagAAWSIQAI6HtQAsmZUKr5EvDf93\ntXUIF6BAKKTe55ddDkWxR0LGIW+8fhjnplGk3tRZAbbLD9RhlrxBUlGBA5yw\nkO3DPpJTJ/6wtoWodfsVEM8QIE6c6yQ5SJvLkjyI4o9fimz2dQoH695PERgA\nTz7h6KkJozEeoy2wGonAUKXdguNE3s3RF90iv4fDNpNuK5PYEhFelkRzaJ9c\nnIyEiTdKPArH85oHmWraXKI7vhM+2yr1OmnMxRxGvbyPYJL4cqDsm8PlBwYz\nxNXPlnlH+bmyaNGr8tO/m6o2rc9HES6FQUh19xd38UCXN+ieEEf8Ui0uRTzT\nLFIEy8aD2W2Q6mDEgHlCHiAtQBaWd/6JpWl2OncrAos1d8slWM+Wgx9LGlbJ\nw3VMwURVCEDjny6oh8hIfxc1E9ujCrrqxd/rrVCP/4EH+DN8uHUWl7ZIYfAU\nMtvTNqPceJTblcFKuykhUtwz3N6ZY0RKqLhzr4rJ8LQDxIF2OEc0+3xKUiGX\nHGEq6o73rDVkE6ly7/BrJQ98OFVB5eTu6pG8gC8iyPhxUPZhe3aUNU8ITb+j\nk54IlHXugaol/qqJwXQFTzNg/EfU9QvrBhfGCqX9pnZ4whPbNILepWVpv0Ux\nKwq0MvU9DybGj1H7+a8eRz4afBQCo+AKDPCCxB+Yz1HxtL6srYTR0gdmu+DG\nntvi\r\n=tiGs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDztRWTXWqktoCqcsG5UujRicDXZWclnUnxMJypcYANAwIhAPLzhC8dBEvQaBEOVneVeXwvWk9edVabZcLw/Rs6jv/0"}]},"maintainers":[{"name":"atayahmet","email":"ahmet.atay@hotmail.com"}],"_npmUser":{"name":"atayahmet","email":"ahmet.atay@hotmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/observer-js_0.0.1-alpha.1_1582049969760_0.9094042457959097"},"_hasShrinkwrap":false},"1.0.0":{"name":"@atayahmet/observer-js","version":"1.0.0","description":"Observer js created based on observer pattern criteria. Create subjects and add it callback as observer.","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"test":"cross-env NODE_ENV=test && jest --config jestconfig.json --no-cache","coverage":"nyc report --reporter=text-lcov | coveralls","build":"tsc","format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"tslint -p tsconfig.json","prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint","version":"npm run format && git add -A src","postversion":"git push && git push --tags"},"repository":{"type":"git","url":"git+https://github.com/atayahmet/observer-js.git"},"keywords":["observer","subject","async","sub","pub"],"author":{"name":"Ahmet ATAY"},"license":"MIT","bugs":{"url":"https://github.com/atayahmet/observer-js/issues"},"homepage":"https://github.com/atayahmet/observer-js#readme","devDependencies":{"@types/jest":"^24.0.9","cross-env":"^5.2.0","jest":"^24.3.1","prettier":"^1.16.4","ts-jest":"^24.0.0","tslint":"^5.13.1","tslint-config-prettier":"^1.18.0","typescript":"^3.3.3333"},"directories":{"lib":"lib"},"dependencies":{},"gitHead":"17e3a75dd38425299aea380bb35571e3344a875a","_id":"@atayahmet/observer-js@1.0.0","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-QgNXo4CLQaLOPMwunw5vPIUfCHrfRw0/DvLE8h6t21G+A2VLxRzzr8LHD6L7/RdnD4qYlIYJuuJSYvEDYbdSGA==","shasum":"c591ed669656911ca3d3d922dedad8f25e2e0a00","tarball":"https://registry.npmjs.org/@atayahmet/observer-js/-/observer-js-1.0.0.tgz","fileCount":5,"unpackedSize":11835,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfs3zTCRA9TVsSAnZWagAAqTsP/0KN4bmlgUzcps/2KlLT\nxCE5BMLWVkGq7A2mlhm3/vQULGDJMT7W6eY+yBgSFF/Cx53IpWbqDTFO0SA2\n2/F1gsYkyBChwxinqlIodyuiCxgobLfISJm6ODrTojbxuPcDzj0zfBpu1hCa\nozClKYKd/mO88bNStsGcM0sswmZsiBVVGxLk604cs7ITqKGVWmCaxHSaca5I\nPQEce6nx9Dj99QAY7kj20SeWzl8ebys1pD43F8PEbwUluwosdA93PnCc/6uG\ntcu24470EFeELGDCJRRAOyiLE3uGFx4hKtjjIB5TsMmHtuKpcEPfOoHa9nm0\nuNXYRFH3ewNFkxLRGr/fbmiam/FmPeqnb5gDCTfRJHzXmD1/VGzA5A9oEN6z\noP3KZ3gGGVMOkRSQ6girQyzfzPKnqtXTy7PjUPl4dSkvtcyWhTMD8W1HDQvU\nBLL12YWBd4oHLVoNeec0RD5nCr8oZcIUoXawP2/dxQrk7lizWXc0ppHlBZxI\nNGI/GZgtLtGt8qwPlVv3oIhE0om9YJCSlP/YjNwhBmUoEop8bK8rUUQ44q4+\nJATKlJQ/7rMU0tQoJzRDnMi7m/vfX3Xay0PUSefp9AfKsryoKDIn5c3S7PZj\ne+4tgNTyp+Xve73bpe4YKXbcv5okcgJys4PtvlYzx/El3cbbqOPxGgttEIxk\nxrla\r\n=/s4+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID8i5gD7jYdOC0z/bEuxx2qoNgWLwzIq4V9fvLXn6v+bAiA4u7Le4mzFhxfj5x4AKt1ZXV/5qD9hqzBeorSxMQTc+g=="}]},"_npmUser":{"name":"atayahmet","email":"ahmet.atay@hotmail.com"},"maintainers":[{"name":"atayahmet","email":"ahmet.atay@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/observer-js_1.0.0_1605598419285_0.03172255620569442"},"_hasShrinkwrap":false}},"time":{"created":"2020-02-18T18:19:29.722Z","0.0.1-alpha.1":"2020-02-18T18:19:29.861Z","modified":"2022-04-04T16:02:44.060Z","1.0.0":"2020-11-17T07:33:39.419Z"},"maintainers":[{"name":"atayahmet","email":"ahmet.atay@hotmail.com"}],"description":"Observer js created based on observer pattern criteria. Create subjects and add it callback as observer.","homepage":"https://github.com/atayahmet/observer-js#readme","keywords":["observer","subject","async","sub","pub"],"repository":{"type":"git","url":"git+https://github.com/atayahmet/observer-js.git"},"author":{"name":"Ahmet ATAY"},"bugs":{"url":"https://github.com/atayahmet/observer-js/issues"},"license":"MIT","readme":"<br />\n<p align=\"center\">\n  <a href=\"https://github.com/chakra-ui/chakra-ui/tree/master/logo\">\n    <img src=\"/logo.png\" alt=\"observer-js\" />\n  </a>\n</p>\n\n<h1 align=\"center\">Create subjects and add observers as callback. ⚡️</h1>\n\n[![Travis CI](https://img.shields.io/travis/atayahmet/observer-js?style=flat-square)](https://img.shields.io/travis/atayahmet/observer-js?style=flat-square) [![Travis CI](https://img.shields.io/npm/v/@atayahmet/observer-js?style=flat-square)](https://img.shields.io/npm/v/@atayahmet/observer-js?style=flat-square) ![npm](https://img.shields.io/npm/dw/@atayahmet/observer-js?style=flat-square) ![GitHub](https://img.shields.io/github/license/atayahmet/observer-js?style=flat-square) ![GitHub issues](https://img.shields.io/github/issues/atayahmet/observer-js?style=flat-square)\n\nSimple light-weight observable pub/sub library. You can create multiple subject and observers and manage these objects using features.\n\n> **Note:** All subscriptions work asynchronously.\n\n## Installation\n\nUse the package manager [yarn](https://yarnpkg.com/) or [npm](https://www.npmjs.com) to install.\n\n```sh\n$ npm i @atayahmet/observer-js --save\n```\n\n```sh\n$ yarn add @atayahmet/observer-js\n```\n\n## Usage\n\n```js\nimport Subject from '@atayahmet/observer-js';\n```\n\n**Create new subject:**\n\n```js\nconst subject = new Subject();\n\n// start subscribe\nsubject.subscribe(data => console.log('Test subscribe 1!', data));\nsubject.subscribe(data => console.log('Test subscribe 2!', data));\n\n// run all observers.\nsubject.notify('Hello World!');\n```\n\n**Unsubscribe an observer:**\n\n```js\nconst subject = new Subject();\nconst sub$ = subject.subscribe(data => console.log('Remove subscription!', data));\n\nsub$.unsubscribe();\n```\n\n**Cancel all observers in one time:**\n\n```js\nsubject.subscribe(() => console.log('Test subscribe 1!'));\nsubject.subscribe(() => console.log('Test subscribe 2!'));\n\n// cancelled.\nsubject.cancel();\n\n// this will not notify to all observers one time\nsubject.notify();\n```\n\n**Pause and Resume observers:**\n\n```js\nsubject.subscribe(() => console.log('Test subscribe 1!'));\nsubject.subscribe(() => console.log('Test subscribe 2!'));\n\n// paused all observers.\nsubject.pause();\n\n// this will not notify observers until you resume observers.\nsubject.notify();\n\n// activate all observers again.\nsubject.resume();\n```\n\n**Reset the subject completely:**\n\n```js\nsubject.reset();\n```\n\n**Get total count of active observers:**\n\n```js\nconst sub1$ = subject.subscribe(() => console.log('Test subscribe 1!'));\nconst sub2$ = subject.subscribe(() => console.log('Test subscribe 2!'));\n\nsubject.size(); // output: 2\n\nsub1$.unsubscribe();\n\nsubject.size(); // output: 1\n```\n\n**onCompleted:**\n\n```js\nsubject.subscribe(data => console.log('Test subscribe 1!'));\nsubject.subscribe(data => console.log('Test subscribe 2!'));\n\nsubject.onCompleted(() => console.log('All observers worked successfuly!'));\nsubject.notify('Go!');\n```\n\n## Built With\n\n- [TypeScript](https://www.typescriptlang.org)\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/atayahmet/observer-js/tags).\n\n## Authors\n\n- [**Ahmet ATAY**](https://github.com/atayahmet) - _Initial work_\n\nSee also the list of [contributors](https://github.com/atayahmet/observer-js/contributors) who participated in this project.\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n","readmeFilename":"README.md"}