Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@twilio/replay-event-emitter

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@twilio/replay-event-emitter - npm Package Compare versions

Comparing version 0.1.0-main.4 to 0.1.0-main.7

2

package.json
{
"name": "@twilio/replay-event-emitter",
"version": "0.1.0-main.4",
"version": "0.1.0-main.7",
"description": "An extension to Node's EventEmitter that supports event replay.",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

@@ -15,12 +15,12 @@ # EventReplayEmitter

```js
import { ReplayEventListener } from "replay-event-listener";
import { ReplayEventEmitter } from "replay-event-emitter";
// Instantiate the event listener
const eventListener = new ReplayEventListener();
// Instantiate the event emitter
const eventEmitter = new ReplayEventEmitter();
// Emit an event before adding a listener
eventListener.emit("exampleEvent", "someData");
eventEmitter.emit("exampleEvent", "someData");
// Subscribe using addListenerWithReplay
eventListener.addListenerWithReplay("exampleEvent", (data) => {
eventEmitter.addListenerWithReplay("exampleEvent", (data) => {
// This handler will get triggered despite the data emission happening BEFORE

@@ -35,3 +35,3 @@ // the event registration.

```js
eventListener.onWithReplay("exampleEvent", (data) => {
eventEmitter.onWithReplay("exampleEvent", (data) => {
console.log(data);

@@ -41,12 +41,12 @@ });

All the original functionality of the EventListener is still intact:
All the original functionality of the EventEmitter is still intact:
```js
import { ReplayEventListener } from "replay-event-listener";
import { ReplayEventEmitter } from "replay-event-emitter";
const eventListener = new ReplayEventListener();
const eventEmitter = new ReplayEventEmitter();
eventListener.emit("exampleEvent", "someData");
eventEmitter.emit("exampleEvent", "someData");
eventListener.addListener("exampleEvent", (data) => {
eventEmitter.addListener("exampleEvent", (data) => {
// This handler will NOT get triggered, as this is not a replay method and the

@@ -53,0 +53,0 @@ // data emission happened BEFORE the event registration.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc