scheduler
Advanced tools
Comparing version 0.0.0-experimental-db69f95e4-20231002 to 0.0.0-experimental-db913d8e17-20240422
@@ -36,4 +36,3 @@ /** | ||
var deadline = 0; | ||
var currentPriorityLevel_DEPRECATED = NormalPriority; // `isInputPending` is not available. Since we have no way of knowing if | ||
// there's pending input, always yield at the end of the frame. | ||
var currentPriorityLevel_DEPRECATED = NormalPriority; // Always yield at the end of the frame. | ||
@@ -93,11 +92,5 @@ function unstable_shouldYield() { | ||
var continuation = result; | ||
var continuationController = new TaskController({ | ||
priority: postTaskPriority | ||
}); | ||
var continuationOptions = { | ||
signal: continuationController.signal | ||
}; // Update the original callback node's controller, since even though we're | ||
// posting a new task, conceptually it's the same one. | ||
node._controller = continuationController; | ||
signal: node._controller.signal | ||
}; | ||
var nextTask = runTask.bind(null, priorityLevel, postTaskPriority, node, continuation); | ||
@@ -104,0 +97,0 @@ |
@@ -29,2 +29,5 @@ /** | ||
var frameYieldMs = 5; | ||
var userBlockingPriorityTimeout = 250; | ||
var normalPriorityTimeout = 5000; | ||
var lowPriorityTimeout = 10000; | ||
@@ -145,12 +148,4 @@ function push(heap, node) { | ||
var maxSigned31BitInt = 1073741823; // Times out immediately | ||
var maxSigned31BitInt = 1073741823; // Tasks are stored on a min heap | ||
var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out | ||
var USER_BLOCKING_PRIORITY_TIMEOUT = 250; | ||
var NORMAL_PRIORITY_TIMEOUT = 5000; | ||
var LOW_PRIORITY_TIMEOUT = 10000; // Never times out | ||
var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap | ||
var taskQueue = []; | ||
@@ -171,6 +166,2 @@ var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. | ||
typeof navigator !== 'undefined' && // $FlowFixMe[prop-missing] | ||
navigator.scheduling !== undefined && // $FlowFixMe[incompatible-type] | ||
navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null; | ||
function advanceTimers(currentTime) { | ||
@@ -391,15 +382,19 @@ // Check for tasks that are no longer delayed and add them to the queue. | ||
case ImmediatePriority: | ||
timeout = IMMEDIATE_PRIORITY_TIMEOUT; | ||
// Times out immediately | ||
timeout = -1; | ||
break; | ||
case UserBlockingPriority: | ||
timeout = USER_BLOCKING_PRIORITY_TIMEOUT; | ||
// Eventually times out | ||
timeout = userBlockingPriorityTimeout; | ||
break; | ||
case IdlePriority: | ||
timeout = IDLE_PRIORITY_TIMEOUT; | ||
// Never times out | ||
timeout = maxSigned31BitInt; | ||
break; | ||
case LowPriority: | ||
timeout = LOW_PRIORITY_TIMEOUT; | ||
// Eventually times out | ||
timeout = lowPriorityTimeout; | ||
break; | ||
@@ -409,3 +404,4 @@ | ||
default: | ||
timeout = NORMAL_PRIORITY_TIMEOUT; | ||
// Eventually times out | ||
timeout = normalPriorityTimeout; | ||
break; | ||
@@ -499,3 +495,3 @@ } | ||
return false; | ||
} // The main thread has been blocked for a non-negligible amount of time. We | ||
} // Yield now. | ||
@@ -506,6 +502,4 @@ | ||
function requestPaint() { | ||
function requestPaint() {} | ||
} | ||
function forceFrameRate(fps) { | ||
@@ -551,3 +545,3 @@ if (fps < 0 || fps > 125) { | ||
} | ||
} // Yielding to the browser will give it a chance to paint, so we can | ||
} | ||
}; | ||
@@ -554,0 +548,0 @@ |
@@ -20,2 +20,5 @@ /** | ||
var frameYieldMs = 5; | ||
var userBlockingPriorityTimeout = 250; | ||
var normalPriorityTimeout = 5000; | ||
var lowPriorityTimeout = 10000; | ||
@@ -136,12 +139,4 @@ function push(heap, node) { | ||
var maxSigned31BitInt = 1073741823; // Times out immediately | ||
var maxSigned31BitInt = 1073741823; // Tasks are stored on a min heap | ||
var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out | ||
var USER_BLOCKING_PRIORITY_TIMEOUT = 250; | ||
var NORMAL_PRIORITY_TIMEOUT = 5000; | ||
var LOW_PRIORITY_TIMEOUT = 10000; // Never times out | ||
var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap | ||
var taskQueue = []; | ||
@@ -162,6 +157,2 @@ var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. | ||
typeof navigator !== 'undefined' && // $FlowFixMe[prop-missing] | ||
navigator.scheduling !== undefined && // $FlowFixMe[incompatible-type] | ||
navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null; | ||
function advanceTimers(currentTime) { | ||
@@ -315,15 +306,19 @@ // Check for tasks that are no longer delayed and add them to the queue. | ||
case ImmediatePriority: | ||
timeout = IMMEDIATE_PRIORITY_TIMEOUT; | ||
// Times out immediately | ||
timeout = -1; | ||
break; | ||
case UserBlockingPriority: | ||
timeout = USER_BLOCKING_PRIORITY_TIMEOUT; | ||
// Eventually times out | ||
timeout = userBlockingPriorityTimeout; | ||
break; | ||
case IdlePriority: | ||
timeout = IDLE_PRIORITY_TIMEOUT; | ||
// Never times out | ||
timeout = maxSigned31BitInt; | ||
break; | ||
case LowPriority: | ||
timeout = LOW_PRIORITY_TIMEOUT; | ||
// Eventually times out | ||
timeout = lowPriorityTimeout; | ||
break; | ||
@@ -333,3 +328,4 @@ | ||
default: | ||
timeout = NORMAL_PRIORITY_TIMEOUT; | ||
// Eventually times out | ||
timeout = normalPriorityTimeout; | ||
break; | ||
@@ -408,3 +404,3 @@ } | ||
return false; | ||
} // The main thread has been blocked for a non-negligible amount of time. We | ||
} // Yield now. | ||
@@ -415,6 +411,4 @@ | ||
function requestPaint() { | ||
function requestPaint() {} | ||
} | ||
var performWorkUntilDeadline = function () { | ||
@@ -445,3 +439,3 @@ if (isMessageLoopRunning) { | ||
} | ||
} // Yielding to the browser will give it a chance to paint, so we can | ||
} | ||
}; | ||
@@ -448,0 +442,0 @@ |
'use strict'; | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./cjs/scheduler.production.min.js'); | ||
module.exports = require('./cjs/scheduler.production.js'); | ||
} else { | ||
module.exports = require('./cjs/scheduler.development.js'); | ||
} |
'use strict'; | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./cjs/scheduler.native.production.min.js'); | ||
module.exports = require('./cjs/scheduler.native.production.js'); | ||
} else { | ||
module.exports = require('./cjs/scheduler.native.development.js'); | ||
} |
{ | ||
"name": "scheduler", | ||
"version": "0.0.0-experimental-db69f95e4-20231002", | ||
"version": "0.0.0-experimental-db913d8e17-20240422", | ||
"description": "Cooperative scheduler for the browser environment.", | ||
@@ -17,6 +17,3 @@ "repository": { | ||
}, | ||
"homepage": "https://reactjs.org/", | ||
"dependencies": { | ||
"loose-envify": "^1.1.0" | ||
}, | ||
"homepage": "https://react.dev/", | ||
"files": [ | ||
@@ -29,10 +26,4 @@ "LICENSE", | ||
"unstable_post_task.js", | ||
"cjs/", | ||
"umd/" | ||
], | ||
"browserify": { | ||
"transform": [ | ||
"loose-envify" | ||
] | ||
} | ||
"cjs/" | ||
] | ||
} |
'use strict'; | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./cjs/scheduler-unstable_mock.production.min.js'); | ||
module.exports = require('./cjs/scheduler-unstable_mock.production.js'); | ||
} else { | ||
module.exports = require('./cjs/scheduler-unstable_mock.development.js'); | ||
} |
'use strict'; | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./cjs/scheduler-unstable_post_task.production.min.js'); | ||
module.exports = require('./cjs/scheduler-unstable_post_task.production.js'); | ||
} else { | ||
module.exports = require('./cjs/scheduler-unstable_post_task.development.js'); | ||
} |
0
2952
99242
15
- Removedloose-envify@^1.1.0
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)