{"bugs":{"url":"https://github.com/libp2p/js-libp2p/issues"},"dist":{"shasum":"a762d7d35fef117f39153e98fed3be4a51d09473","tarball":"https://registry.npmjs.org/@libp2p/interfaces/-/interfaces-3.3.2-ea8a0637.tgz","fileCount":24,"integrity":"sha512-aJZ4JtqDaYQAClMDDZ4iJ4GWd2RhYQUOPOHtAad0ByQLhBUs+4KqVL2w3ZnllDLB3t0YvThjlJxszVu3D3mjbA==","signatures":[{"sig":"MEQCIHBekKzc1sxC1o5w9Xivs3gGzS7IiWoIatMgMOMWMVMTAiAfoZEmEuPRIKk0f9hsQx5RZRWq4/yb23JTiER2PdCauw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28335},"name":"@libp2p/interfaces","type":"module","types":"./dist/src/index.d.ts","readme":"# @libp2p/interfaces <!-- omit in toc -->\n\n[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)\n[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)\n[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p)\n[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster)\n\n> Common code shared by the various libp2p interfaces\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [AbortError](#aborterror)\n  - [Events](#events)\n  - [AbortOptions](#abortoptions)\n  - [Startable](#startable)\n- [API Docs](#api-docs)\n- [License](#license)\n- [Contribution](#contribution)\n\n## Install\n\n```console\n$ npm i @libp2p/interfaces\n```\n\n## Usage\n\n### AbortError\n\nThrow an error with a `.code` property of `'ABORT_ERR'`:\n\n```js\nimport { AbortError } from '@libp2p/interfaces/errors'\n\nthrow new AbortError()\n```\n\n### Events\n\nTyped events:\n\n```js\nimport { EventEmitter, CustomEvent } from '@libp2p/interfaces/events'\n\nexport interface MyEmitterEvents {\n  'some-event': CustomEvent<number>;\n}\n\nclass MyEmitter extends EventEmitter<MyEmitterEvents> {\n\n}\n\n// later\nconst myEmitter = new MyEmitter()\nmyEmitter.addEventListener('some-event', (evt) => {\n  const num = evt.detail // <-- inferred as number\n})\n```\n\n### AbortOptions\n\n```js\nimport type { AbortOptions } from '@libp2p/interfaces'\n```\n\n### Startable\n\nLifecycles for components\n\n```js\nimport { start, stop, isStartable } from '@libp2p/interfaces/startable'\nimport type { Startable } from '@libp2p/interfaces/startable'\n\nclass MyStartable implements Startable {\n  // .. implementation methods\n}\n\nconst myStartable = new MyStartable()\n\nisStartable(myStartable) // returns true\n\nawait start(myStartable)\nawait stop(myStartable)\n```\n\n## API Docs\n\n- <https://libp2p.github.io/js-libp2p/modules/_libp2p_interfaces.html>\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","exports":{".":{"types":"./dist/src/index.d.ts","import":"./dist/src/index.js"},"./errors":{"types":"./dist/src/errors.d.ts","import":"./dist/src/errors.js"},"./events":{"types":"./dist/src/events.d.ts","import":"./dist/src/events.js"},"./startable":{"types":"./dist/src/startable.d.ts","import":"./dist/src/startable.js"}},"gitHead":"ea8a06378d6733c0bcac28bed3aa3baef1e30ead","license":"Apache-2.0 OR MIT","scripts":{"lint":"aegir lint","build":"aegir build","clean":"aegir clean","dep-check":"aegir dep-check"},"typedoc":{"entryPoint":"./src/index.ts"},"_npmUser":{"name":"npm-service-account-libp2p","email":"npm-service-account+libp2p@protocol.ai"},"homepage":"https://github.com/libp2p/js-libp2p/tree/master/packages/interfaces#readme","keywords":["interface","libp2p"],"repository":{"url":"git+https://github.com/libp2p/js-libp2p.git","type":"git"},"_npmVersion":"8.19.4","description":"Common code shared by the various libp2p interfaces","directories":{},"maintainers":[{"name":"jacobheun","email":"jacobheun@gmail.com"},{"name":"npm-service-account-libp2p","email":"npm-service-account+libp2p@protocol.ai"},{"name":"alanshaw","email":"alan138@gmail.com"},{"name":"vascosantos","email":"santos.vasco10@gmail.com"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"daviddias","email":"mail@daviddias.me"}],"_nodeVersion":"18.16.0","eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"aegir":"^39.0.10"},"_npmOperationalInternal":{"tmp":"tmp/interfaces_3.3.2-ea8a0637_1687170372522_0.30785100353370587","host":"s3://npm-registry-packages"},"_id":"@libp2p/interfaces@3.3.2-ea8a0637","version":"3.3.2-ea8a0637"}