Recording and Playback for Bespoke.js
Record and replay Bespoke.js slide interactions from local storage and JSON data.
Download the production version or the development version, or use a package manager.
This plugin is shipped in a UMD format, meaning that it is available as a CommonJS/AMD module or browser global.
For example, when using CommonJS modules:
var bespoke = require('bespoke'),
vcr = require('bespoke-vcr');
bespoke.from('article', [
vcr()
]);
When using browser globals:
bespoke.from('article', [
bespoke.plugins.vcr()
]);
Press 'R' on your keyboard to toggle recording. Press 'S' to stop recording. Press 'P' to play the latest recording.
Recordings are saved to local storage and persist between page loads.
Notifications are displayed in your JavaScript console during recording and playback.
To see JSON representations of recordings, run one of the following commands in your console:
// Latest recording:
vcr.latest();
// All recordings:
vcr.all();
Recordings can be provided on load via the 'recording' option:
bespoke.from(selector, {
vcr: {
recording: [
{
"command": "next",
"timeout": 10000
},
{
"command": "next",
"timeout": 20000
},
{
"command": "next",
"timeout": 30000
},
{
"timeout": 40000
}
]
}
});
Press 'P' to start the saved recording.
The default remote uses the 'R', 'P' and 'S' keys.
To override this behavious, pass a 'remote' function via the options object:
bespoke.from(selector, {
vcr: {
remote: function(remote) {
// Toggle recording:
remote.record();
// Stop recording
remote.stop();
// Toggle plaback
remote.play();
}
}
});
$ npm install bespoke-vcr
$ bower install bespoke-vcr
This plugin was built with generator-bespokeplugin.