Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A precise implementation of setInterval that supports sub-millisecond intervals.

License

Notifications You must be signed in to change notification settings

fabiospampinato/performance-interval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

8 Commits

Repository files navigation

Performance Interval

A precise implementation of setInterval that supports sub-millisecond intervals.

This doesn't block the main thread, but it does block another thread, which AFAIK is the only way to implement this in an isomorphic way. So make sure to not use this in production because it's still expensive.

Install

npm install performance-interval

Usage

import {setPerformanceInterval, clearPerformanceInterval} from 'performance-interval';
// Scheduling a sub-millisecond precise interval
const interval = 0.5; // 500 microseconds
const intervalId = setPerformanceInterval ( () => {
 console.log ( performance.now () ); // Called every 500 microseconds
}, interval );
// Clearing a precise interval
setTimeout ( () => {
 clearPerformanceInterval ( intervalId );
}, 1000 );

License

MIT © Fabio Spampinato

About

A precise implementation of setInterval that supports sub-millisecond intervals.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /