{"_id":"@atom-iq/teardown","_rev":"1-95eeafad01bcc847d33f50d164a4576a","name":"@atom-iq/teardown","dist-tags":{"latest":"0.2.0-alpha"},"versions":{"0.2.0-alpha":{"name":"@atom-iq/teardown","version":"0.2.0-alpha","description":"Atom-iQ Teardown Middleware - Add Subscriptions/Teardown to Atom-iQ Auto-Unsubscribe System","author":{"name":"Adam Filipek","email":"adamfilipek1@gmail.com","url":"https://github.com/adamf92"},"license":"MIT","main":"dist/index.umd.min.js","module":"dist/index.es.min.js","types":"dist/lib/types/src/index.d.ts","peerDependencies":{"@atom-iq/core":"0.2.0-alpha","rxjs":"^7.0.0-beta.8"},"devDependencies":{"@atom-iq/core":"^0.2.0-alpha","rxjs":"^7.0.0-beta.8"},"licenseText":"# MIT License\nCopyright (c) 2020 Adam Filipek\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","_id":"@atom-iq/teardown@0.2.0-alpha","dist":{"shasum":"e35c91493ec39cdb31ead6af1425aaf6230ea563","integrity":"sha512-a9OooqrRvEkIaCh6gZY7f2HZqGFgQcYi11EN2wOiOld8Bf8h6F1H8OSsjSoN3j8OBVwCKlwj+82eMM/YRpaFrw==","tarball":"https://registry.npmjs.org/@atom-iq/teardown/-/teardown-0.2.0-alpha.tgz","fileCount":23,"unpackedSize":7364,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkE/NCRA9TVsSAnZWagAAgT0P/i8nsJFPCLLvHFfykv+p\nR0ZV5lHD2dgOzGuerkGWIkeHJSdTlXx6ZkFs9bFMQa2jiEFciwswQvGYDHRX\nYcJZNQKMMOqlshmGmqYecLLZRlLY6T1Pad5OElkJRs/ynBYBBD0Qaz1CrOxq\nSduqT6YgflRuMkhTGQv4+weJZhHKCFnh33TDJ61RA+WJV0uaXhNwHOeL5GNA\nVMlbFBI/d22NCVc7tTH1nj3Jx7+k+zIq3NUd2u7Q5PTML3u+wRWNonYxFPVr\nSke1QM9NnsEx7Fjylet0ITcj1pvfUWaxLcZXZyaG2OgwqvPXtWrfazHVZULh\nsAg8G2nQvzEGnoOhX1YWc8dqfnsqLMw6+MBYi5TvO46kRHqrPNMfOFhtBoYR\nPCd1tFeCk6KY3O0vPFZCSIk01AKaXc9kct9n1WoOT91FLMb5i5iS7MaF5C0q\nNk+deISAOIoAZ008StNp8OtRjnIf77qg6humKxcA66lAT0mDqHC3QGWo8429\npnWumzDigwKHgjSF++lEGTRMiGbqottI88zHHkPpO/unCo/kK3jiyYwrkVZl\n/ZQBR15mXqIO9dMlSUqIDX0R9sGcCAGfsYOsnZYJWDxw3HI48k25q4ViHegm\nQo8tWEz6w+QJTqmRBWntMw0HnsXCce0Vu4NsViqDpsvmleZFQoqlsUxeTIX6\ntFlX\r\n=wJGS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEGyV7/uwho7dBiHu33KwqhhgGZYCjsVC2p5XVdvbW+FAiBV48cdb8EbmRlEBKZC7phuvI9/tbD/QtR+fRnVoowXEA=="}]},"maintainers":[{"name":"adamf","email":"adamfilipek1@gmail.com"}],"_npmUser":{"name":"adamf","email":"adamfilipek1@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/teardown_0.2.0-alpha_1603293132789_0.25427763782095236"},"_hasShrinkwrap":false}},"time":{"created":"2020-10-21T15:12:12.484Z","0.2.0-alpha":"2020-10-21T15:12:12.895Z","modified":"2022-04-04T16:14:14.315Z"},"maintainers":[{"name":"adamf","email":"adamfilipek1@gmail.com"}],"description":"Atom-iQ Teardown Middleware - Add Subscriptions/Teardown to Atom-iQ Auto-Unsubscribe System","author":{"name":"Adam Filipek","email":"adamfilipek1@gmail.com","url":"https://github.com/adamf92"},"license":"MIT","readme":"# Atom-iQ Teardown Middleware (`@atom-iq/teardown`)\n#### Installing\n- npm - `npm install --save @atom-iq/teardown`\n- yarn - `yarn add @atom-iq/teardown`\n\n\n#### Teardown\nMiddleware allowing adding Teardown logic to Atom-iQ Auto-unsubscribe system.\n\nTeardown logic is the RxJS Subscription or any function, and is called on main\nSubscription unsubscribe (in Teardown Middleware case, it's after Component is\nremoved from **Reactive Virtual DOM** - it's unsubscribing all nested Subscriptions\nand calling all passed Teardown function\n\n> ##### Note\n> With current Core implementation, Teardown logic is added to parent element children subscription.\n> It's not expected behavior, Components should have own separate subscriptions -  it will be fixed\n> in one of v0.2.0 pre-releases. However, it's a Core package bug and **won't** affect Teardown\n> Middleware API and implementation\n\n#### Starting the app\n```typescript jsx\nimport App from './App'\nimport { createRvDOM, combineMiddlewares } from '@atom-iq/core'\nimport { teardownMiddleware } from '@atom-iq/teardown'\n\nconst middlewares = combineMiddlewares(teardownMiddleware())()\n\ncreateRvDOM(middlewares)(<App />, document.getElementById('root'))\n```\n\n#### Usage\n```typescript jsx\nimport { RvdComponent, createState } from '@atom-iq/core'\nimport { WithTeardown } from '@atom-iq/teardown'\n\nconst App: RvdComponent<{}, WithTeardown> = (_props, { teardown }) => {\n  const [someState, nextSomeState] = createState('Teardown Middleware')\n  \n  const subscription = someState.subscribe(state => console.log(state))\n  \n  const fn = () => console.log('Destroyed')\n  \n  teardown(subscription)\n  teardown(fn)\n  \n  return (\n    <main class=\"App\">\n      Atom-iQ Teardown Middleware\n    </main>\n  )\n}\n\nApp.useMiddlewares = ['teardown']\n```\n\n## Documentation\n- [Framework](../../README.md)\n- [Reactive Virtual DOM](../../docs/reactive-virtual-dom/REACTIVE-VIRTUAL-DOM.md)\n- [Component](../../docs/framework/COMPONENT.md)\n- [Elements](../../docs/framework/ELEMENTS.md)\n- [Middleware](../../docs/framework/MIDDLEWARE.md)\n\n","readmeFilename":"README.md"}