Permalink
Cannot retrieve contributors at this time
72 lines (52 sloc)
1.33 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/propagate/README.md
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# propagate | |
[][npmjs] | |
[][build] | |
[][coverage] | |
[npmjs]: https://www.npmjs.com/package/propagate | |
[build]: https://travis-ci.org/nock/propagate | |
[coverage]: https://coveralls.io/github/nock/propagate | |
Propagate events from one event emitter into another. | |
## Install | |
```bash | |
$ npm install propagate | |
``` | |
## Propagate | |
```javascript | |
var ee1 = new EventEmitter() | |
var ee2 = new EventEmitter() | |
propagate(ee1, ee2) | |
ee2.on('event', function(a, b) { | |
console.log('got propagated event', a, b) | |
}) | |
ee1.emit('event', 'a', 'b') | |
``` | |
## Unpropagate | |
You can unpropagate by ending the propagation like this: | |
```javascript | |
var ee1 = new EventEmitter() | |
var ee2 = new EventEmitter() | |
var p = propagate(ee1, ee2) | |
// ... | |
p.end() | |
``` | |
## Only propagate certain events: | |
```javascript | |
var ee1 = new EventEmitter() | |
var ee2 = new EventEmitter() | |
var p = propagate(['event1', 'event2'], ee1, ee2) | |
``` | |
## Propagate certain events as other events: | |
```javascript | |
var ee1 = new EventEmitter() | |
var ee2 = new EventEmitter() | |
var p = propagate( | |
{ | |
event1: 'other-event1', | |
event2: 'other-event2', | |
}, | |
ee1, | |
ee2 | |
) | |
``` | |
# License | |
MIT |