replay.js
v0.0.4
Published
recording and replaying method calls
Downloads
5
Readme
replay.js
A simple recorder/proxy generator for JavaScript, that allows you to capture method calls and replay them onto a given function/scope at a later point in time.
Test
grunt test
or for dev mode grunt watch:test
Installation
npm install replay.js
or just load within a browser (works with CommonJS, AMD and Vanilla JS)
Versions
- 0.0.1: Initial version
Usage
The following example records calls to the recorder and then replays them onto the console
.
var ReplayJS = require('replay.js');
var recorder = ReplayJS.recorder();
recorder('Hello', 'World');
recorder('Hello', 'you');
ReplayJS.play(recorder, console.log, console);
// Hello World
// Hello you
var ReplayJS = require('replay.js');
var recorder = ReplayJS.recorder();
recorder(1);
recorder(2);
recorder(3);
var arr = [];
ReplayJS.play(recorder, Array.prototype.push, arr);
// arr = [1,2,3]
License
MIT (see LICENSE file)