
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@bufferapp/chronos
Advanced tools
A small library to handle browser timining measures
install it
npm i --save @bufferapp/chronos
import chronos from '@bufferapp/chronos';
const ch = chronos();
The simplest way to measure something is to start the measure with ch.startMeasure('bar') and then stop it ch.stopMeasure('bar').
To store the measure you should define a storing method when you instatiate Chronos passing it down in the configuration options
const ch = chronos({
store: (data) => {
…
}
})
When that is provided Chronos will auto save the measures for you.
Chronos is using requestIdleCallback to parse and store measures, so autosave won't effect your app performances, anyway you are free to disable this behaviour setting autoSave: false in the options.
In this case you can manually save measures with ch.saveToStore().
You can measure anything against browser timing event with ch.measureFromSpecialEvent({ name: 'foo', eventName: 'navigationStart' }), there is also a convenient method to measure against Navigation Start ch.measureFromNavigationStart('foo').
If you want to store any extra data along with your measures you can pass a data object in measure start options ch.startMeasure({name: 'foo', data: {tags: ['foo', 'bar']}}), the data field will be passed down to your store method.
Happy measuring!
FAQs
A small library to handle browser timining measures
We found that @bufferapp/chronos demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?

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.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.