1.1.1 • Published 4 months ago

replay-emitter v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Replay-emitter

Replay-emitter is a simple tool to record/replay events from a file to nodejs EventEmitter.

CI

Installation

npm install replay-emitter
yarn add replay-emitter

Options

OptionTypeDefaultDescription
offsetnumber0time offset
modeauto \| manualautoSpecify the mode
eventsstring[][]If manual mode, the events you wanna record

Usage

Record events

import handler, { replayEnd } from 'replay-emitter';
import { EventEmitter } from 'events';
// After registering all the `.on` and `.once` listeners

const emitter = new EventEmitter();
handler(emitter)

// When you did finish recording enough sample

setTimeout(async () => {
  await replayEnd()
  console.log('REPLAY END')
  
  // This function is gonna save the events to the replay.txt file at the root of the project
}, 10000)

Replay events

import handler, { replayEnd } from 'replay-emitter';
import { EventEmitter } from 'events';
// After registering all the `.on` and `.once` listeners

const emitter = new EventEmitter();

const startFunction = await execute(emitter, 'pathtothefile/replay.txt');

// start the replay
await startFunction();
1.1.1

4 months ago

1.1.0

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago