{"name":"@servie/events","version":"2.0.1","publishConfig":{"access":"public"},"description":"Tiny type-safe event emitter","license":"MIT","repository":{"type":"git","url":"git://github.com/serviejs/events.git"},"author":{"name":"Blake Embrey","email":"hello@blakeembrey.com","url":"http://blakeembrey.me"},"homepage":"https://github.com/serviejs/events","bugs":{"url":"https://github.com/serviejs/events/issues"},"main":"dist/index.js","scripts":{"format":"ts-scripts format","lint":"ts-scripts lint","prepare":"ts-scripts install && ts-scripts build","size":"size-limit","specs":"ts-scripts specs","test":"ts-scripts test && npm run size"},"keywords":["events","emitter","types","typescript","micro"],"devDependencies":{"@borderless/ts-scripts":"^0.3.0","@size-limit/preset-small-lib":"^4.10.2","@types/jest":"^26.0.22","@types/node":"^14.14.37","size-limit":"^4.10.2","typescript":"^4.2.4"},"types":"dist/index.d.ts","sideEffects":false,"size-limit":[{"path":"dist/index.js","limit":"200 B"}],"gitHead":"f7a2b6e53991d9bb18fc05b1506249fe2fb4662d","_id":"@servie/events@2.0.1","_nodeVersion":"15.12.0","_npmVersion":"7.9.0","dist":{"integrity":"sha512-pBHYUt2SlMqdsObGI+8qexxwLTZbt8Hvzk6Q7oWiJn2s+zFyjhdFxv+4/Jit1MQ91F4CbfN34Gz25LGp+ZHgAQ==","shasum":"3adcd41828cc5d021b456097719e23986d86a8de","tarball":"http://registry-npm.ywwl.com/@servie/events/download/@servie/events-2.0.1.tgz","fileCount":9,"unpackedSize":19765,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgcAEPCRA9TVsSAnZWagAAEf4P/2Fw1M4cy3x5j0hey/2m\noF4MrMQxKM53+PjtiIvToFvq8sYAL+vE94a9OG4gKaF8MzxeDWT6lYfgw1Of\nPja3X+Fm5CaTycDv4CxvQd8hlc3HJyqZZYRS7CRGOUoDeOI0p+FQX8wmzfgB\npfAF9y84Y5lOAAk3RFNaEFfNzV2KK3m3t/78DiR/9zeg6ctiRWnV2FjT+dV2\nALxufxehbXWF8ieARoyIMo6pjir00wh9w4pqMqeiZjvv92WChGDLS1Xl+hmF\ntV2Pf/SX68Nk91d+GFQk12wtjUelzBi8yX3s7v/HHLQXDtbjRakBE1jG5yxd\nF6dnyfKURQic+1b9ujkFpqLDmabyZ9dVCtXSCQ4Qp1jkuqXPRl9AQ+U4cvVC\nuFXax5XohS5CrrSHjkb5AOWXWdv6hhB8D1Be1275eb9BiUDwNVH+QRlhhvgw\n1Y02kD8Hw/91ep4CcnEPq10JmXEmB2xernwIZxxT7RhKyrvATQy2HK2ElZnG\nwnavlRfHyPEhkIlAz0APeWzsqP1WQAzFPBhqMWM+7e5MSOkSzJOhJ1rI3t8D\ncJl0764OHKkFpCb1qRjbD+v2EyXc+QqQgArC4O6d2ki8adhoBs7gkyg7myPh\ntfEFDe33g6/vPX82X8OcuHzphA94yz+LI1GcMkW79zhttA4+R1/aqeI+H+yF\n/akS\r\n=x2+D\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCvJLbtvPgjSom23vU/TgHZ2P0W3DkqXjvhtzf6axT3DwIhAP1InfA93oUwJgPxKxaXR0uTFDn1ECIQEgB3yHfK7Kbw"}],"size":4979,"noattachment":false,"key":"/@servie/events/-/@servie/events-2.0.1.tgz"},"_npmUser":{"name":"blakeembrey","email":"hello@blakeembrey.com"},"directories":{},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/events_2.0.1_1617953038795_0.464863009877845"},"_hasShrinkwrap":false,"readme":"# Events\n\n[![NPM version][npm-image]][npm-url]\n[![NPM downloads][downloads-image]][downloads-url]\n[![Build status][build-image]][build-url]\n[![Build coverage][coverage-image]][coverage-url]\n[![Bundle size][bundlephobia-image]][bundlephobia-url]\n\n> Tiny type-safe event emitter.\n\n## Installation\n\n```\nnpm install @servie/events --save\n```\n\n## Usage\n\n```ts\nimport { Emitter, once, ALL_EVENTS } from \"@servie/events\";\n\n// Define an events interface using keys & argument tuples.\ninterface Events {\n  test: [boolean];\n  other: [string];\n}\n\n// Initialize an `Emitter` using your `Events` interface.\nconst events = new Emitter<Events>();\n\n// Add or remove listeners.\nconst listener = (...args) => console.log(args);\nconst off = events.on(\"test\", listener);\n\n// Emit an event.\nevents.emit(\"test\", true);\n\n// Listen to _all_ events, i.e. for debugging.\nconst eachListener = ({ type, args }) => console.log(type, args);\nconst off = events.on(ALL_EVENTS, eachListener);\n\n// \"Once\" utility.\nconst runOnce = (...args) => console.log(args);\nonce(events, \"test\", runOnce);\n\n// Remove the listener.\noff();\n```\n\n## TypeScript\n\nThis project is written using [TypeScript](https://github.com/Microsoft/TypeScript) and publishes the definitions directly to NPM.\n\n## License\n\nMIT\n\n[npm-image]: https://img.shields.io/npm/v/@servie/events\n[npm-url]: https://npmjs.org/package/@servie/events\n[downloads-image]: https://img.shields.io/npm/dm/@servie/events\n[downloads-url]: https://npmjs.org/package/@servie/events\n[build-image]: https://img.shields.io/github/workflow/status/serviejs/events/CI/main\n[build-url]: https://github.com/serviejs/events/actions/workflows/ci.yml?query=branch%3Amain\n[coverage-image]: https://img.shields.io/codecov/c/gh/serviejs/events\n[coverage-url]: https://codecov.io/gh/serviejs/events\n[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/@servie/events.svg\n[bundlephobia-url]: https://bundlephobia.com/result?p=@servie/events\n","publish_time":1617953038950,"_cnpm_publish_time":1617953038950,"dist-tags":{"latest":"3.0.0"}}