GithubHelp home page GithubHelp logo

mmg1 / keystroke-recorder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from data-doge/keystroke-recorder

0.0 1.0 0.0 12 KB

record keystrokes as json

Home Page: https://www.npmjs.com/package/keystroke-recorder

JavaScript 100.00%

keystroke-recorder's Introduction

keystroke-recorder

record and playback user keystrokes. use this tool ethically -- never collect user data without their explicit knowledge + consent.

install

npm i --save keystroke-recorder

usage

import $ from 'jquery'
import KeystrokeRecorder from 'keystroke-recorder'
var keystrokeRecorder = new KeystrokeRecorder({
  omittedKeys: ['Tab', 'Meta', 'Control', 'Alt', 'Shift']
})

$('#record-btn').click(() => {
  keystrokeRecorder.record()
})

$('#stop-btn').click(() => {
  keystrokeRecorder.stop()
  console.log(keystrokeRecorder.json)
})

$('#replay-btn').click(() => {
  keystrokeRecorder.replay('#replay-pad').then(() => {
    console.log('done replaying!')
  })
})

API

options

  • omittedKeys

    an array of keys to be ignored during recording. default: []

methods

  • record()

    starts collecting keystroke data as json

  • stop()

    stops collecting keystroke data

  • replay(selector)

    replays recorded keystrokes in DOM element with specified selector. returns a promise that resolves on completion.

  • load(json)

    stops recording and loads given json into keystrokeRecorder

  • timeElapsed()

    return milliseconds since recording started

properties

  • json

    returns json data for last keystroke recording

    [
        {
            keyCode: 65,
            key: "a",
            ms: 562
        },
        {
            keyCode: 83,
            key: "s",
            ms: 771
        },
        {
            keyCode: 68,
            key: "d",
            ms: 998
        },
        {
            keyCode: 70,
            key: "f",
            ms: 1642
        }
    ]
  • startTime

    time that last recording started at

  • recording

    boolean indicating whether keystrokeRecorder is recording or not

keystroke-recorder's People

Contributors

data-doge avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.