Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

tempo-tap

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tempo-tap

tap tempo object measures speed of successive invocations

latest
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

Tempo Tap

tap tempo object to measure speed of successive invocations

install

npm install tempo-tap

example

var { TapTempo } = require('tempo-tap');

let tempo = 0;

TapTempo.tap();
setTimeout(() => (tempo = TapTempo.tap()), 1000);
setTimeout(() => (tempo = TapTempo.tap()), 2000);
setTimeout(() => (tempo = TapTempo.tap()), 3000);
setTimeout(() => (tempo = TapTempo.tap()), 4000);

console.log(tempo); // 60

TapTempo.tap()

records a tap with Date.now(), stores inside TimeContainer returns current tempo or -1 for insufficient data

TapTempo.getLastTempo()

returns the last calculated tempo as a number

TapTempo.clear()

clears TimeContainer, reinitiates the object

TapTempo.setThreshold()

sets how many values TimeContainer must contain until it can make a tempo calculation - default is 3

license

Dual-licensed under the MIT License or the Apache License, version 2.0

FAQs

Package last updated on 03 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts