{"_id":"draht","_rev":"326017","name":"draht","description":"draht provides process-level messaging.","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"time":{"modified":"2021-06-07T02:44:42.000Z","created":"2015-02-26T15:52:43.463Z","1.0.1":"2018-02-12T16:16:23.994Z","1.0.0":"2018-02-08T19:06:14.529Z","0.4.2":"2017-02-23T10:45:40.289Z","0.4.1":"2017-02-20T11:43:46.046Z","0.4.0":"2017-02-09T08:16:48.058Z","0.3.0":"2015-02-26T15:52:43.463Z"},"users":{},"repository":{"type":"git","url":"git://github.com/thenativeweb/draht.git"},"versions":{"1.0.1":{"name":"draht","version":"1.0.1","description":"draht provides process-level messaging.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"dist/Draht.js","dependencies":{"eventemitter2":"5.0.1"},"devDependencies":{"assertthat":"1.0.0","roboter":"0.15.6","roboter-server":"0.15.6"},"repository":{"type":"git","url":"git://github.com/thenativeweb/draht.git"},"keywords":["eventbus","messaging"],"license":"MIT","gitHead":"7ff6b0e97b8320a618001f541bca4540aaebe89e","bugs":{"url":"https://github.com/thenativeweb/draht/issues"},"homepage":"https://github.com/thenativeweb/draht#readme","_id":"draht@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"goloroden","email":"webmaster@goloroden.de"},"dist":{"shasum":"c4c8879923d2130dfa9c5930e956c85d62b1e975","size":96284,"noattachment":false,"key":"/draht/-/draht-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/draht/download/draht-1.0.1.tgz"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/draht_1.0.1_1518452183122_0.7034803059663761"},"_hasShrinkwrap":false,"publish_time":1518452183994,"_cnpm_publish_time":1518452183994},"1.0.0":{"name":"draht","version":"1.0.0","description":"draht provides process-level messaging.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"dist/Draht.js","dependencies":{"eventemitter2":"5.0.1"},"devDependencies":{"assertthat":"1.0.0","roboter":"0.15.6","roboter-server":"0.15.6"},"repository":{"type":"git","url":"git://github.com/thenativeweb/draht.git"},"keywords":["eventbus","messaging"],"license":"MIT","gitHead":"9f6f9eb13fc1410d52251e1d07f624e63b6f70a9","bugs":{"url":"https://github.com/thenativeweb/draht/issues"},"homepage":"https://github.com/thenativeweb/draht#readme","_id":"draht@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"goloroden","email":"webmaster@goloroden.de"},"dist":{"shasum":"5d8e14a33c21ea21440c74cfbd4baac7cd0755e5","size":96279,"noattachment":false,"key":"/draht/-/draht-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/draht/download/draht-1.0.0.tgz"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/draht_1.0.0_1518116773377_0.11948518192223534"},"_hasShrinkwrap":false,"publish_time":1518116774529,"_cnpm_publish_time":1518116774529},"0.4.2":{"name":"draht","version":"0.4.2","description":"draht provides process-level messaging.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"dist/draht.js","dependencies":{"eventemitter2":"3.0.0"},"devDependencies":{"assertthat":"0.8.3","roboter":"0.14.6","roboter-server":"0.14.6"},"repository":{"type":"git","url":"git://github.com/thenativeweb/draht.git"},"keywords":["eventbus","messaging"],"license":"MIT","gitHead":"53d330e25c2eead05938ff1ba136e93e5af3c2c7","bugs":{"url":"https://github.com/thenativeweb/draht/issues"},"homepage":"https://github.com/thenativeweb/draht#readme","_id":"draht@0.4.2","scripts":{},"_shasum":"f7c6f721224fbeb21a1fe6d737089d0f3ced1df9","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"goloroden","email":"webmaster@goloroden.de"},"dist":{"shasum":"f7c6f721224fbeb21a1fe6d737089d0f3ced1df9","size":95972,"noattachment":false,"key":"/draht/-/draht-0.4.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/draht/download/draht-0.4.2.tgz"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/draht-0.4.2.tgz_1487846739595_0.12099968991242349"},"directories":{},"publish_time":1487846740289,"_cnpm_publish_time":1487846740289,"_hasShrinkwrap":false},"0.4.1":{"name":"draht","version":"0.4.1","description":"draht provides process-level messaging.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"lib/draht.js","dependencies":{"eventemitter2":"3.0.0"},"devDependencies":{"assertthat":"0.8.3","roboter":"0.14.3","roboter-server":"0.14.3"},"browserify":{"transform":[["babelify",{"presets":["es2015"]}]]},"repository":{"type":"git","url":"git://github.com/thenativeweb/draht.git"},"keywords":["eventbus","messaging"],"license":"MIT","gitHead":"edf8af0517350bf607ff1f2c81210b5e51b4f05b","bugs":{"url":"https://github.com/thenativeweb/draht/issues"},"homepage":"https://github.com/thenativeweb/draht#readme","_id":"draht@0.4.1","scripts":{},"_shasum":"55eba8ffac111ee9568173b6ebd6cc7ede9bca29","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"goloroden","email":"webmaster@goloroden.de"},"dist":{"shasum":"55eba8ffac111ee9568173b6ebd6cc7ede9bca29","size":95599,"noattachment":false,"key":"/draht/-/draht-0.4.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/draht/download/draht-0.4.1.tgz"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/draht-0.4.1.tgz_1487591023957_0.6806095743086189"},"directories":{},"publish_time":1487591026046,"_cnpm_publish_time":1487591026046,"_hasShrinkwrap":false},"0.4.0":{"name":"draht","version":"0.4.0","description":"draht provides process-level messaging.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"lib/draht.js","dependencies":{"eventemitter2":"3.0.0"},"devDependencies":{"assertthat":"0.8.3","roboter":"0.14.3","roboter-server":"0.14.3"},"repository":{"type":"git","url":"git://github.com/thenativeweb/draht.git"},"keywords":["eventbus","messaging"],"license":"MIT","gitHead":"42d2a8939c35c06de353f65ad0278aaeac962c52","bugs":{"url":"https://github.com/thenativeweb/draht/issues"},"homepage":"https://github.com/thenativeweb/draht#readme","_id":"draht@0.4.0","scripts":{},"_shasum":"4b150e75ec76aacf18bbc3b23f0326eac4cc5c92","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"goloroden","email":"webmaster@goloroden.de"},"dist":{"shasum":"4b150e75ec76aacf18bbc3b23f0326eac4cc5c92","size":95532,"noattachment":false,"key":"/draht/-/draht-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/draht/download/draht-0.4.0.tgz"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/draht-0.4.0.tgz_1486628205839_0.017299468629062176"},"directories":{},"publish_time":1486628208058,"_cnpm_publish_time":1486628208058,"_hasShrinkwrap":false},"0.3.0":{"name":"draht","version":"0.3.0","description":"draht provides process-level messaging.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"lib/draht.js","dependencies":{"eventemitter2":"0.4.14"},"devDependencies":{"assertthat":"0.5.1","grunt":"0.4.5","tourism":"0.14.0"},"repository":{"type":"git","url":"git://github.com/thenativeweb/draht.git"},"license":"MIT","gitHead":"a3911d9cc0ca4ae2a13a0528d7312d7468c4e7d9","bugs":{"url":"https://github.com/thenativeweb/draht/issues"},"homepage":"https://github.com/thenativeweb/draht","_id":"draht@0.3.0","scripts":{},"_shasum":"2a1c99c6a24384ddc832e1d589b44fb9c5ffdf34","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"thenativeweb","email":"hello@thenativeweb.io"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"dist":{"shasum":"2a1c99c6a24384ddc832e1d589b44fb9c5ffdf34","size":94785,"noattachment":false,"key":"/draht/-/draht-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/draht/download/draht-0.3.0.tgz"},"directories":{},"publish_time":1424965963463,"_cnpm_publish_time":1424965963463,"_hasShrinkwrap":false}},"readme":"# draht\n\ndraht provides process-level messaging.\n\n![draht](https://github.com/thenativeweb/draht/raw/master/images/logo.jpg \"draht\")\n\n## Installation\n\n```shell\n$ npm install draht\n```\n\n## Quick start\n\nThe first thing you need to do is to integrate draht into your application. For that add a reference to the `draht` module.\n\n```javascript\nconst Draht = require('draht');\n```\n\n### Accessing the global draht\n\nTo access the global draht, you need to get the `instance` property:\n\n```javascript\nconst draht = Draht.instance;\n```\n\n### Creating your own draht\n\nIf you need your own draht channel, create a new instance:\n\n```javascript\nconst draht = new Draht();\n```\n\n### Using a draht\n\n#### Emitting events\n\nTo emit an event, call the draht's `emit` function and provide the event name as well as its payload as parameters. Optionally, you may specify a callback.\n\n```javascript\ndraht.emit('foo', { bar: 'baz' }, () => {\n  // ...\n});\n```\n\n*Please note that the `emit` function internally calls `process.nextTick` to make sure that an event is processed asynchronously.*\n\nYou can also emit namespaced events. For that, prefix the event name with the namespace name and separate them by using the expression `::`.\n\n```javascript\ndraht.emit('demo::foo', { bar: 'baz' }, () => {\n  // ...\n});\n```\n\n#### Subscribing to events\n\nTo subscribe to an event, call the `on` function and provide the name of the event you want to subscribe to as well as an event handling function.\n\n```javascript\ndraht.on('demo::foo', (evt, callback) => {\n  // ...\n});\n```\n\nAlternatively you may also use the `once` function to subscribe to an event and have the handler automatically removed afterwards.\n\n```javascript\ndraht.once('demo::foo', (evt, callback) => {\n  // ...\n});\n```\n\nIf you want to receive all events within a specific namespace, you can use the `*` character.\n\n```javascript\ndraht.on('demo::*', (evt, callback) => {\n  // ...\n});\n```\n\nNested namespaces are supported as well, but please note that when using wildcards you need to specify them for each namespace level separately. E.g., if you have events in the form `foo::bar::baz` and you would like to subscribe to any event in the `foo` namespace, use `foo::*::*`, not `foo::*`.\n\n#### Unsubscribing from events\n\nFrom time to time you need to unsubscribe from an event. For this use the `removeListener` function and provide the event name as well as the handler to remove. Please note that in this case you need to provide the very same handler instance to `removeListener` as you previously used.\n\n```javascript\nconst onFoo = function (evt, callback) {\n  // ...\n};\n\ndraht.on('demo::foo', onFoo);\n// ...\ndraht.removeListener('demo::foo', onFoo);\n```\n\nTo remove all listeners for an event use `removeAllListeners` and provide only the event name.\n\n```javascript\ndraht.removeAllListeners('demo::foo');\n```\n\nIf you omit the event name, too, then all listeners for all events are unsubscribed.\n\n```javascript\ndraht.removeAllListeners();\n```\n\n## Running the build\n\nTo build this module use [roboter](https://www.npmjs.com/package/roboter).\n\n```shell\n$ bot\n```\n\n## License\n\nThe MIT License (MIT)\nCopyright (c) 2013-2018 the native web.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_attachments":{},"homepage":"https://github.com/thenativeweb/draht#readme","bugs":{"url":"https://github.com/thenativeweb/draht/issues"},"license":"MIT"}