stackmat.js

1.0.1 • Public • Published

Stackmat.js

Build Status npm version

Stackmat.js is a library for JavaScript which helps you to access the Stackmat Timer from your web application.

Usage

First, create a Stackmat.Timer object and pass in a callback function which gets called every time the timer sends a signal - around five times a second.

var options = {
  signalReceived: function(state) {
    console.log("Current Time: " + signal.getTimeAsString())
  }
};
var timer = new Stackmat.Timer(options);

then enable capturing input by calling start

timer.start();

If you don't want to receive any further data call timer.stop().

The signalReceived callback gets one argument: The current state of the Stackmat timer. Available methods on it are:

state.getTimeAsString();       // => "0:32.12"
state.getTimeInMilliseconds(); // => 32120
state.isRunning();             // => true
state.isReset();               // => false
state.isLeftHandPressed();     // => true
state.isRightHandPressed();    // => false

More options:

var options = {
    onNonSupportedBrowser: function(){...},
    signalReceived: function(state){...}
}

Contribute

You must have Node.js.

# Clone this repository
git clone git@github.com:timhabermaas/stackmat.js.git

# Install the dependencies
cd stackmat.js
npm install

Build the library (and run tests):

npm run build

Run tests:

npm run test

# or

npm run test:auto

Run the example:

npm run example

Package Sidebar

Install

npm i stackmat.js

Weekly Downloads

2

Version

1.0.1

License

MIT

Last publish

Collaborators

  • ldez