Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@twilio/replay-event-emitter
Advanced tools
An extension to Node's EventEmitter that supports event replay. In other words,
if a listener is added using either addListenerWithReplay
or onWithReplay
,
then it will instantly trigger the listener with previous event data (if no data
was previously emitted, then the listener will not get triggered on
registration).
In order to get event replay on listener registration, simply utilize the
addListenerWithReplay
method like so:
import { ReplayEventEmitter } from "replay-event-emitter";
// Instantiate the event emitter
const eventEmitter = new ReplayEventEmitter();
// Emit an event before adding a listener
eventEmitter.emit("exampleEvent", "someData");
// Subscribe using addListenerWithReplay
eventEmitter.addListenerWithReplay("exampleEvent", (data) => {
// This handler will get triggered despite the data emission happening BEFORE
// the event registration.
console.log(data);
});
You could also use the shorthand method onWithRepeat
, like so:
eventEmitter.onWithReplay("exampleEvent", (data) => {
console.log(data);
});
All the original functionality of the EventEmitter is still intact:
import { ReplayEventEmitter } from "replay-event-emitter";
const eventEmitter = new ReplayEventEmitter();
eventEmitter.emit("exampleEvent", "someData");
eventEmitter.addListener("exampleEvent", (data) => {
// This handler will NOT get triggered, as this is not a replay method and the
// data emission happened BEFORE the event registration.
console.log(data);
});
FAQs
An extension to Node's EventEmitter that supports event replay.
The npm package @twilio/replay-event-emitter receives a total of 58,994 weekly downloads. As such, @twilio/replay-event-emitter popularity was classified as popular.
We found that @twilio/replay-event-emitter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.