New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

main-thread-scheduling

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

main-thread-scheduling - npm Package Compare versions

Comparing version 4.0.0-0 to 4.0.0-1

2

package.json
{
"name": "main-thread-scheduling",
"version": "4.0.0-0",
"version": "4.0.0-1",
"description": "Consistently responsive apps while staying on the main thread",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -0,22 +1,39 @@

import nextTask from './nextTask';
// #hack
let shouldRequestAnimationFrame = false;
const idlePhaseTracker = createPhaseTracker((callback) => {
if (typeof requestIdleCallback === 'undefined') {
return;
}
const handleIdleCallback = () => {
requestIdleCallback((deadline) => {
shouldRequestAnimationFrame = true;
callback({
deadline,
start: Date.now(),
if (typeof requestIdleCallback === 'undefined') {
nextTask(() => {
shouldRequestAnimationFrame = true;
const start = Date.now();
const deadline = start + 16;
callback({
start: start,
deadline: {
timeRemaining() {
return Math.max(deadline - Date.now(), 0);
},
didTimeout: false,
},
});
shouldRequestAnimationFrame = false;
});
shouldRequestAnimationFrame = false;
}, {
// #WET 2021-06-05T3:07:18+03:00
// #connection 2021-06-05T3:07:18+03:00
// call at least once per frame
// asuming 60 fps, 1000/60 = 16.667
timeout: 16,
});
}
else {
requestIdleCallback((deadline) => {
shouldRequestAnimationFrame = true;
callback({
deadline,
start: Date.now(),
});
shouldRequestAnimationFrame = false;
}, {
// #WET 2021-06-05T3:07:18+03:00
// #connection 2021-06-05T3:07:18+03:00
// call at least once per frame
// asuming 60 fps, 1000/60 = 16.667
timeout: 16,
});
}
};

@@ -23,0 +40,0 @@ if (shouldRequestAnimationFrame) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc