1.0.0 • Published 7 years ago
cross-event-loop-lag v1.0.0
cross-event-loop-lag
Measures event loop lag on browsers or node.
Just a fork of event-loop-lag but works on both nodejs environment and browsers.
Install
$ npm i cross-event-loop-lagUsage
import {factory} from 'cross-event-loop-lag'
const interval = 50
const lag = factory(interval)
someHeavyMethod()
lag() // 500, get the lag measurementfactory(interval: number)
- interval
numberThe number of milliseconds representing how often to refresh the event loop lag measurement.
Creates a function lag which can be invoked to return the latest lag measurement in ms. Besides, we can use lag.destroy() to stop the measuring and destroy the timer inside.
After lag.destroy()ed, lag() will always return 0
// Destroy the timer and stop measuring
lag.destroy()
lag() // 0
lag() // 0License
MIT
1.0.0
7 years ago