npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@alexcambose/recjs

v1.0.3

Published

Lightweight user session recorder based on JSON

Downloads

9

Readme

recjs

JavaScript Style Guide Build Status

Lightweight user session recorder based on JSON

Installation

In browser:

<script src="dist/dist.js"></script>

In Node.js

npm install --save @alexcambose/recjs
import Recjs from 'recjs';

Usage

...
<body>
    <div id="someElement"></div>
</body>
...

Example 1

const recjs = new Recjs({
    el: '#someElement',
});
recjs.recorder.record(); // starts recording

setTimeout(() => {
    recjs.recorder.stop(); // stops recording after 3 seconds
    console.log(recjs.recorder.getData()) // gets recording data
}, 3000);

Example 2

const recjs = new Recjs({
    el: '#someElement',
});
recjs.recorder.record(); // starts recording

setTimeout(() => {
    recjs.recorder.stop(); // stops recording after 3 seconds
    recjs.player.play(recjs.recorder.getData(), () => console.log('Finished')); // plays current recording and logs when finishes
}, 3000);

API Reference

Classes

Recjs

Kind: global class

new Recjs($0)

| Param | Type | Default | Description | | --- | --- | --- | --- | | $0 | Object | | | | $0.el | string | | Target element that is going to be recorded | | [$0.events] | array | ['scroll', 'mousemove', 'keypress', 'click', 'contextmenu'] | User events that will be recorded | | [$0.fps] | integer | 30 | Number of frames per second | | [$0.document] | object | window.document | Document object to be used. (in case of an iframe) |

Example

const recjs = new Recjs({
    el: '#someElement',
    events: ['scroll'],
    fps: 60
});

Recorder

Recorder class

Kind: global class

recorder.record()

Starts recording

Kind: instance method of Recorder Example

recjs.recorder.record()

recorder.isRecording() ⇒ boolean

Check if it is recording

Kind: instance method of Recorder Returns: boolean - True if it's recording Example

recjs.recorder.isRecording()

recorder.stop()

Stops recording

Kind: instance method of Recorder Example

recjs.recorder.stop()

recorder.pause()

Pauses current recording

Kind: instance method of Recorder Example

recjs.recorder.pause()

recorder.getData(stringify) ⇒ object | string

Returns recorded data

Kind: instance method of Recorder

| Param | Type | Default | | --- | --- | --- | | stringify | boolean | false |

Example

recjs.recorder.getData(true)

Player

Player class

Kind: global class

player.play(data, onEnd)

Starts playing a recording

Kind: instance method of Player

| Param | Type | Description | | --- | --- | --- | | data | object | Recorded data | | onEnd | function | Calls when playing finishes |

Example

recjs.player.play(recjs.recorder.getData(), () => {
    console.log('Finished playing')
})

player.pause()

Pauses playing

Kind: instance method of Player Example

recjs.player.pause()

player.stop()

Stops playing

Kind: instance method of Player Example

recjs.player.stop()

player.setFrameIndex(index)

Set current frame

Kind: instance method of Player

| Param | Type | Description | | --- | --- | --- | | index | number | Frame index |

Example

recjs.player.setFrameIndex(87)

player.currentFrame() ⇒ object

Get current frame

Kind: instance method of Player Returns: object - Frame object Example

recjs.player.currentFrame()

player.currentFrameIndex() ⇒ number

Get current frame index

Kind: instance method of Player Returns: number - Frame index Example

recjs.player.currentFrameIndex()

player.isPlaying() ⇒ boolean

Is playing

Kind: instance method of Player Returns: boolean - Returns true if it is playing Example

recjs.player.isPlaying()