{"bugs":{"url":"https://github.com/jsless/hable/issues"},"dist":{"shasum":"f4599b6ef56e676e9d57b34f0b2b9fc0cb1aadb5","tarball":"https://registry.npmjs.org/hable/-/hable-3.0.0-0.tgz","fileCount":12,"integrity":"sha512-5wLrQP/SMBkVslX7ODFMecfjo//HiHPz4jzS8fjLbJrGHuHKl5TLJWAKJScZzNcfXp7akXlgGMu2fNaXMB+Gzw==","signatures":[{"sig":"MEUCIGZrrzXaw1Ca8lOiumPyGO39Zg/AzRfL26M1uoER6OXwAiEAz+z9kiUm1FG+FDUmtty3gWcuBUBpJtvMHtqKECcacbs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":23984,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdbAUmCRA9TVsSAnZWagAAVT8QAJmyPVClP5jwZfZqI3Q1\nZTKNtZWtP0eQQ1uGA80RzmzkHzuBn3cPdpqh+wgFymeE4jnSeb5MP3neh8L/\ndp/250gJ+EXVaOZ6TbAhM8obkF9k3A78xmPg5CMizF7mYhqRBuWcc+ZtJwSp\nJW4NSMmsvvmwzRpZI8OZNRPS0ExVjVRJwlmiYZgOf6iF88zE1Vn/pGnVHJQw\nHgFJyvRrura/d4WipWVmIxx9lRIVy5zkSRJtBKJ/1IpJMx1KNEBT0njdmmpY\nL04eWGuyq13LljZdaGnEAZ/tzBfBfGvNSwrzQYSWiTNHA3SoeejvSbI57tV1\nPHN1+WjbLR3FHEG53OFX0aq5UbWDKY/GKgGkumImaWva4mBDBKzbDayvSE4W\n4xLIx3c1xDT1GSAAMNQqrZZGvk5iz6zLm5350n5sl3TeM8yIFGS9c1Qct0jM\nuWvAKScc7LhQQ0Rtii2FGDjWsRvggty4NBNQJoXzfthhSRdOQz1oMp+8/Q+R\nQeSo0/859IujBrrO1KizBzPICXROUHLI32Mx+Eh7hIH0Q8R1ULH04Td+t+a6\n+j2yx6bftQCidLIhIZDIRok7UvParOIUEouH7xsbCMYt0bKAAAEynoLJDhat\nv0W7AtEw7NN3wwFxJvx8E2wONq+kWgvinoS/m4x4M9pE/ZBZyjbCjbgB4srn\nBwBp\r\n=BdRN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/hable.js","name":"hable","readme":"# Hable\n\n[![CircleCI](https://img.shields.io/circleci/project/github/jsless/hable.svg?style=flat-square)](https://circleci.com/gh/jsless/hable)\n[![Codecov](https://img.shields.io/codecov/c/github/jsless/hable.svg?style=flat-square)](https://codecov.io/gh/jsless/hable)\n[![npm](https://img.shields.io/npm/v/hable.svg?style=flat-square)](https://www.npmjs.com/package/hable)\n[![npm](https://img.shields.io/npm/dt/hable.svg?style=flat-square)](https://www.npmjs.com/package/hable)\n[![size](http://img.badgesize.io/https://unpkg.com/hable/dist/hable.cjs.min.js?compression=gzip&style=flat-square)](https://unpkg.com/hable)\n\n> Awaitable hooks for Node.js\n\n## Install\n\nUsing yarn:\n\n```bash\nyarn add hable\n```\n\nUsing npm:\n\n```bash\nnpm install hable\n```\n\n## Usage\n\n**Extend your base class from Hable:**\n\n```js\nimport Hookable from 'hable'\n\nexport default class Foo extends Hookable {\n  constructor() {\n    // Call to parent to initialize\n    super()\n    // Initialize Hookable with custom logger\n    // super(consola)\n  }\n\n  async someFunction() {\n    // Call and wait for `hook1` hooks (if any) sequential\n    await this.callHook('hook1')\n\n    // Call and wait for `hook2` hooks (if any) in parallel\n    await this.callHookParallel('hook2')\n  }\n}\n```\n\n**Inside plugins, register for any hook:**\n\n```js\nconst lib = newFooLib()\n\n// Register a handler for `hook2`\nlib.hook('hook2', async () => { /* ... */ })\n\n// Register multiply handlers at once\nlib.hookObj({\n  hook1: async () => { /* ... */ },\n  hook2: [ /* can be also an array */ ]\n})\n```\n\n## Hookable class\n\n### `constructor(logger)`\n\nCustom logger. Default logger is `console` but you can use your own or [consola](https://github.com/nuxt/consola).\n\nIt should be an object implementing following functions:\n- warn\n- error\n- fatal (optional)\n\n### `hook (name, fn)`\n\nRegister a handler for a specific hook. `fn` can be a single function or an array.\n\n### `addHooks(configHooks)`\n\nFlatten and register hooks object.\n\nExample:\n\n```js\nhookable.addHooks({\n  test: {\n    before: () => {},\n    after: () => {}\n  }\n})\n\n```\n\nThis registers `test:before` and `test:after` hooks at bulk.\n\n### `async callHook (name, ...args)`\n\nUsed by class itself to **sequentially** call handlers of a specific hook.\n\n### `deprecateHook (old, name)`\n\nDeprecate hook called `old` in favor of `name` hook.\n\n### `deprecateHooks (deprecatedHooks)`\n\nDeprecate all hooks from an object (keys are old and values or newer ones).\n\n### `clearHook (name)`\n\nClear all hooks for a specific hook.\n\n### `clearHooks ()`\n\nClear all hooks registered in the class.\n\n### `flatHooks (hooksObj)`\n\nRegister many hooks using an object.\n\n## Credits\n\nExtracted from [Nuxt.js](github.com/nuxt/nuxt.js) hooks system. Original author: [Sébastien Chopin](https://github.com/Atinux).\n\n## License\n\nMIT\n","browser":"dist/hable.umd.js","gitHead":"f5a10472dbb01167b0d8f1c61956cde4a77921b7","license":"MIT","scripts":{"lint":"eslint src","test":"yarn lint && yarn jest","build":"bili --module-name hable --minify --format cjs,umd,es src/hable.js","release":"standard-version && git push --follow-tags && npm publish","prepublish":"yarn build && yarn test"},"_npmUser":{"name":"pi0","email":"pyapar@gmail.com"},"homepage":"https://github.com/jsless/hable#readme","keywords":["hook","hookable","plugin","tapable","tappable"],"repository":{"url":"git+https://github.com/jsless/hable.git","type":"git"},"_npmVersion":"6.9.0","description":"Awaitable hooks for Node.js","directories":{},"maintainers":[{"name":"pi0","email":"pyapar@gmail.com"}],"_nodeVersion":"12.4.0","contributors":[{"url":"@Atinux","name":"Sebastien Chopin"},{"url":"@clarkdo","name":"Clark Du"},{"url":"@pi0","name":"Pooya Parsa"}],"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"bili":"^4.8.1","jest":"^24.1.0","eslint":"^5.13.0","codecov":"^3.0.0","standard-version":"^5.0.1","eslint-plugin-jest":"^22.2.2","eslint-plugin-node":"^8.0.1","eslint-plugin-import":"^2.16.0","eslint-plugin-promise":"^4.0.1","eslint-config-standard":"^12.0.0","eslint-plugin-standard":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hable_3.0.0-0_1567360293745_0.44195522459188785","host":"s3://npm-registry-packages"},"_id":"hable@3.0.0-0","version":"3.0.0-0"}