mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
Rename schedule to scheduler (#13683)
This commit is contained in:
parent
9b70816642
commit
7ea3ca1d13
|
|
@ -2,7 +2,7 @@
|
|||
<html style="width: 100%; height: 100%;">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Schedule Test Page</title>
|
||||
<title>Scheduler Test Page</title>
|
||||
<style>
|
||||
.correct {
|
||||
border: solid green 2px;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Schedule Fixture</h1>
|
||||
<h1>Scheduler Fixture</h1>
|
||||
<p>
|
||||
This fixture is for manual testing purposes, and the patterns used in
|
||||
implementing it should not be used as a model. This is mainly for anyone
|
||||
|
|
@ -89,14 +89,15 @@
|
|||
<div> If the counter advanced while you were away from this tab, it's correct.</div>
|
||||
</li>
|
||||
</ol>
|
||||
<script src="../../build/dist/schedule.development.js"></script>
|
||||
<script src="../../build/dist/react.development.js"></script>
|
||||
<script src="../../build/node_modules/scheduler/umd/scheduler.development.js"></script>
|
||||
<script src="https://unpkg.com/babel-standalone@6/babel.js"></script>
|
||||
<script type="text/babel">
|
||||
const {
|
||||
unstable_scheduleWork: scheduleWork,
|
||||
unstable_cancelWork: cancelWork,
|
||||
unstable_now: now
|
||||
} = Schedule;
|
||||
} = Scheduler;
|
||||
function displayTestResult(testNumber) {
|
||||
const expectationNode = document.getElementById('test-' + testNumber + '-expected');
|
||||
const resultNode = document.getElementById('test-' + testNumber);
|
||||
|
|
@ -63,8 +63,8 @@
|
|||
</li>
|
||||
</ol>
|
||||
<!-- Load the tracing API before react to test that it's lazily evaluated -->
|
||||
<script src="../../build/node_modules/schedule/umd/schedule.development.js"></script>
|
||||
<script src="../../build/node_modules/schedule/umd/schedule-tracing.development.js"></script>
|
||||
<script src="../../build/node_modules/scheduler/umd/scheduler.development.js"></script>
|
||||
<script src="../../build/node_modules/scheduler/umd/scheduler-tracing.development.js"></script>
|
||||
<script src="../../build/node_modules/react/umd/react.development.js"></script>
|
||||
<script src="../../build/node_modules/react-dom/umd/react-dom.development.js"></script>
|
||||
<script src="./script.js"></script>
|
||||
|
|
|
|||
|
|
@ -28,15 +28,15 @@ function runAllTests() {
|
|||
function checkSchedulerAPI() {
|
||||
runTest(document.getElementById('checkSchedulerAPI'), () => {
|
||||
if (
|
||||
typeof Schedule === 'undefined' ||
|
||||
typeof Schedule.unstable_now !== 'function' ||
|
||||
typeof Schedule.unstable_scheduleWork !== 'function' ||
|
||||
typeof Schedule.unstable_cancelScheduledWork !== 'function'
|
||||
typeof Scheduler === 'undefined' ||
|
||||
typeof Scheduler.unstable_now !== 'function' ||
|
||||
typeof Scheduler.unstable_scheduleWork !== 'function' ||
|
||||
typeof Scheduler.unstable_cancelScheduledWork !== 'function'
|
||||
) {
|
||||
throw 'API is not defined';
|
||||
}
|
||||
|
||||
if (Schedule.unstable_now() !== performance.now()) {
|
||||
if (Scheduler.unstable_now() !== performance.now()) {
|
||||
throw 'API does not work';
|
||||
}
|
||||
|
||||
|
|
@ -47,20 +47,20 @@ function checkSchedulerAPI() {
|
|||
function checkSchedulerTracingAPI() {
|
||||
runTest(document.getElementById('checkSchedulerTracingAPI'), () => {
|
||||
if (
|
||||
typeof ScheduleTracing === 'undefined' ||
|
||||
typeof ScheduleTracing.unstable_clear !== 'function' ||
|
||||
typeof ScheduleTracing.unstable_getCurrent !== 'function' ||
|
||||
typeof ScheduleTracing.unstable_getThreadID !== 'function' ||
|
||||
typeof ScheduleTracing.unstable_trace !== 'function' ||
|
||||
typeof ScheduleTracing.unstable_wrap !== 'function'
|
||||
typeof SchedulerTracing === 'undefined' ||
|
||||
typeof SchedulerTracing.unstable_clear !== 'function' ||
|
||||
typeof SchedulerTracing.unstable_getCurrent !== 'function' ||
|
||||
typeof SchedulerTracing.unstable_getThreadID !== 'function' ||
|
||||
typeof SchedulerTracing.unstable_trace !== 'function' ||
|
||||
typeof SchedulerTracing.unstable_wrap !== 'function'
|
||||
) {
|
||||
throw 'API is not defined';
|
||||
}
|
||||
|
||||
try {
|
||||
let interactionsSet;
|
||||
ScheduleTracing.unstable_trace('test', 123, () => {
|
||||
interactionsSet = ScheduleTracing.unstable_getCurrent();
|
||||
SchedulerTracing.unstable_trace('test', 123, () => {
|
||||
interactionsSet = SchedulerTracing.unstable_getCurrent();
|
||||
});
|
||||
if (interactionsSet.size !== 1) {
|
||||
throw null;
|
||||
|
|
@ -74,10 +74,10 @@ function checkSchedulerTracingAPI() {
|
|||
}
|
||||
|
||||
const ForwardedSchedulerTracing =
|
||||
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing;
|
||||
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing;
|
||||
|
||||
if (
|
||||
ScheduleTracing.unstable_getThreadID() ===
|
||||
SchedulerTracing.unstable_getThreadID() ===
|
||||
ForwardedSchedulerTracing.unstable_getThreadID()
|
||||
) {
|
||||
throw 'API forwarding is broken';
|
||||
|
|
@ -90,9 +90,9 @@ function checkSchedulerTracingSubscriptionsAPI() {
|
|||
document.getElementById('checkSchedulerTracingSubscriptionsAPI'),
|
||||
() => {
|
||||
if (
|
||||
typeof ScheduleTracing === 'undefined' ||
|
||||
typeof ScheduleTracing.unstable_subscribe !== 'function' ||
|
||||
typeof ScheduleTracing.unstable_unsubscribe !== 'function'
|
||||
typeof SchedulerTracing === 'undefined' ||
|
||||
typeof SchedulerTracing.unstable_subscribe !== 'function' ||
|
||||
typeof SchedulerTracing.unstable_unsubscribe !== 'function'
|
||||
) {
|
||||
throw 'API is not defined';
|
||||
}
|
||||
|
|
@ -114,9 +114,9 @@ function checkSchedulerTracingSubscriptionsAPI() {
|
|||
};
|
||||
|
||||
try {
|
||||
ScheduleTracing.unstable_subscribe(subscriber);
|
||||
ScheduleTracing.unstable_trace('foo', 123, () => {});
|
||||
ScheduleTracing.unstable_unsubscribe(subscriber);
|
||||
SchedulerTracing.unstable_subscribe(subscriber);
|
||||
SchedulerTracing.unstable_trace('foo', 123, () => {});
|
||||
SchedulerTracing.unstable_unsubscribe(subscriber);
|
||||
if (onInteractionTracedCalls.length !== 1) {
|
||||
throw null;
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ function checkSchedulerTracingSubscriptionsAPI() {
|
|||
if (interaction.name !== 'foo' || interaction.timestamp !== 123) {
|
||||
throw null;
|
||||
}
|
||||
ScheduleTracing.unstable_trace('bar', 456, () => {});
|
||||
SchedulerTracing.unstable_trace('bar', 456, () => {});
|
||||
if (onInteractionTracedCalls.length !== 1) {
|
||||
throw null;
|
||||
}
|
||||
|
|
@ -134,13 +134,13 @@ function checkSchedulerTracingSubscriptionsAPI() {
|
|||
|
||||
const ForwardedSchedulerTracing =
|
||||
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
||||
.ScheduleTracing;
|
||||
.SchedulerTracing;
|
||||
|
||||
try {
|
||||
ForwardedSchedulerTracing.unstable_subscribe(subscriber);
|
||||
ScheduleTracing.unstable_trace('foo', 123, () => {});
|
||||
SchedulerTracing.unstable_trace('foo', 123, () => {});
|
||||
ForwardedSchedulerTracing.unstable_trace('bar', 456, () => {});
|
||||
ScheduleTracing.unstable_unsubscribe(subscriber);
|
||||
SchedulerTracing.unstable_unsubscribe(subscriber);
|
||||
if (onInteractionTracedCalls.length !== 3) {
|
||||
throw null;
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ function checkEndToEndIntegration() {
|
|||
const onRender = (...args) => onRenderCalls.push(args);
|
||||
const container = document.createElement('div');
|
||||
|
||||
ScheduleTracing.unstable_trace('render', 123, () => {
|
||||
SchedulerTracing.unstable_trace('render', 123, () => {
|
||||
ReactDOM.render(
|
||||
React.createElement(
|
||||
React.unstable_Profiler,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
import React, {Placeholder, PureComponent} from 'react';
|
||||
import {unstable_scheduleWork} from 'schedule';
|
||||
import {unstable_trace as trace, unstable_wrap as wrap} from 'schedule/tracing';
|
||||
import {unstable_scheduleWork} from 'scheduler';
|
||||
import {
|
||||
unstable_trace as trace,
|
||||
unstable_wrap as wrap,
|
||||
} from 'scheduler/tracing';
|
||||
import {createResource} from 'simple-cache-provider';
|
||||
import {cache} from '../cache';
|
||||
import Spinner from './Spinner';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React, {Fragment, PureComponent} from 'react';
|
||||
import {unstable_createRoot, render} from 'react-dom';
|
||||
import {unstable_trace as trace} from 'schedule/tracing';
|
||||
import {unstable_trace as trace} from 'scheduler/tracing';
|
||||
import {cache} from './cache';
|
||||
import {
|
||||
setFakeRequestTime,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ There are also known bugs and inefficiencies in master so **don't use this fixtu
|
|||
# 1: Build react from source
|
||||
cd /path/to/react
|
||||
yarn
|
||||
yarn build dom-client,core,simple-cache-provider,schedule --type=NODE
|
||||
yarn build dom-client,core,simple-cache-provider,scheduler --type=NODE
|
||||
|
||||
# 2: Install fixture dependencies
|
||||
cd fixtures/unstable-async/time-slicing/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React, {PureComponent} from 'react';
|
||||
import {flushSync, render} from 'react-dom';
|
||||
import {unstable_scheduleWork} from 'schedule';
|
||||
import {unstable_scheduleWork} from 'scheduler';
|
||||
import _ from 'lodash';
|
||||
import Charts from './Charts';
|
||||
import Clock from './Clock';
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
"loose-envify": "^1.1.0",
|
||||
"object-assign": "^4.1.1",
|
||||
"prop-types": "^15.6.2",
|
||||
"schedule": "^0.5.0"
|
||||
"scheduler": "^0.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.0.0"
|
||||
|
|
|
|||
2
packages/react-art/src/ReactARTHostConfig.js
vendored
2
packages/react-art/src/ReactARTHostConfig.js
vendored
|
|
@ -9,7 +9,7 @@ export {
|
|||
unstable_now as now,
|
||||
unstable_scheduleWork as scheduleDeferredCallback,
|
||||
unstable_cancelScheduledWork as cancelDeferredCallback,
|
||||
} from 'schedule';
|
||||
} from 'scheduler';
|
||||
import Transform from 'art/core/transform';
|
||||
import Mode from 'art/modes/current';
|
||||
import invariant from 'shared/invariant';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
"loose-envify": "^1.1.0",
|
||||
"object-assign": "^4.1.1",
|
||||
"prop-types": "^15.6.2",
|
||||
"schedule": "^0.5.0"
|
||||
"scheduler": "^0.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.0.0"
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export {
|
|||
unstable_now as now,
|
||||
unstable_scheduleWork as scheduleDeferredCallback,
|
||||
unstable_cancelScheduledWork as cancelDeferredCallback,
|
||||
} from 'schedule';
|
||||
} from 'scheduler';
|
||||
|
||||
let SUPPRESS_HYDRATION_WARNING;
|
||||
if (__DEV__) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"dependencies": {
|
||||
"object-assign": "^4.1.1",
|
||||
"prop-types": "^15.6.2",
|
||||
"schedule": "^0.5.0"
|
||||
"scheduler": "^0.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.0.0"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
"loose-envify": "^1.1.0",
|
||||
"object-assign": "^4.1.1",
|
||||
"prop-types": "^15.6.2",
|
||||
"schedule": "^0.5.0"
|
||||
"scheduler": "^0.9.0"
|
||||
},
|
||||
"browserify": {
|
||||
"transform": [
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@
|
|||
import type {Fiber} from './ReactFiber';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {TimeoutHandle, NoTimeout} from './ReactFiberHostConfig';
|
||||
import type {Interaction} from 'schedule/src/Tracing';
|
||||
import type {Interaction} from 'scheduler/src/Tracing';
|
||||
|
||||
import {noTimeout} from './ReactFiberHostConfig';
|
||||
import {createHostRootFiber} from './ReactFiber';
|
||||
import {NoWork} from './ReactFiberExpirationTime';
|
||||
import {enableSchedulerTracing} from 'shared/ReactFeatureFlags';
|
||||
import {unstable_getThreadID} from 'schedule/tracing';
|
||||
import {unstable_getThreadID} from 'scheduler/tracing';
|
||||
|
||||
/* eslint-disable no-use-before-define */
|
||||
// TODO: This should be lifted into the renderer.
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
import type {Fiber} from './ReactFiber';
|
||||
import type {Batch, FiberRoot} from './ReactFiberRoot';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {Interaction} from 'schedule/src/Tracing';
|
||||
import type {Interaction} from 'scheduler/src/Tracing';
|
||||
|
||||
import {__interactionsRef, __subscriberRef} from 'schedule/tracing';
|
||||
import {__interactionsRef, __subscriberRef} from 'scheduler/tracing';
|
||||
import {
|
||||
invokeGuardedCallback,
|
||||
hasCaughtError,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ describe('ReactTracing', () => {
|
|||
const ReactFeatureFlags = require('shared/ReactFeatureFlags');
|
||||
ReactFeatureFlags.enableSchedulerTracing = false;
|
||||
|
||||
require('schedule/tracing');
|
||||
require('scheduler/tracing');
|
||||
|
||||
ReactFeatureFlags.enableSchedulerTracing = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
"object-assign": "^4.1.1",
|
||||
"prop-types": "^15.6.2",
|
||||
"react-is": "^16.5.2",
|
||||
"schedule": "^0.5.0"
|
||||
"scheduler": "^0.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.0.0"
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
"loose-envify": "^1.1.0",
|
||||
"object-assign": "^4.1.1",
|
||||
"prop-types": "^15.6.2",
|
||||
"schedule": "^0.5.0"
|
||||
"scheduler": "^0.9.0"
|
||||
},
|
||||
"browserify": {
|
||||
"transform": [
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
unstable_cancelScheduledWork,
|
||||
unstable_now,
|
||||
unstable_scheduleWork,
|
||||
} from 'schedule';
|
||||
} from 'scheduler';
|
||||
import {
|
||||
__interactionsRef,
|
||||
__subscriberRef,
|
||||
|
|
@ -21,7 +21,7 @@ import {
|
|||
unstable_trace,
|
||||
unstable_unsubscribe,
|
||||
unstable_wrap,
|
||||
} from 'schedule/tracing';
|
||||
} from 'scheduler/tracing';
|
||||
import ReactCurrentOwner from './ReactCurrentOwner';
|
||||
import ReactDebugCurrentFrame from './ReactDebugCurrentFrame';
|
||||
|
||||
|
|
@ -38,12 +38,12 @@ if (__UMD__) {
|
|||
// This re-export is only required for UMD bundles;
|
||||
// CJS bundles use the shared NPM package.
|
||||
Object.assign(ReactSharedInternals, {
|
||||
Schedule: {
|
||||
Scheduler: {
|
||||
unstable_cancelScheduledWork,
|
||||
unstable_now,
|
||||
unstable_scheduleWork,
|
||||
},
|
||||
ScheduleTracing: {
|
||||
SchedulerTracing: {
|
||||
__interactionsRef,
|
||||
__subscriberRef,
|
||||
unstable_clear,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ function loadModules({
|
|||
ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = replayFailedUnitOfWorkWithInvokeGuardedCallback;
|
||||
|
||||
React = require('react');
|
||||
SchedulerTracing = require('schedule/tracing');
|
||||
SchedulerTracing = require('scheduler/tracing');
|
||||
|
||||
if (useNoopRenderer) {
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
|
|
@ -1460,7 +1460,7 @@ describe('Profiler', () => {
|
|||
);
|
||||
expect(onInteractionScheduledWorkCompleted).not.toHaveBeenCalled();
|
||||
|
||||
// The schedule/tracing package will notify of work started for the default thread,
|
||||
// The scheduler/tracing package will notify of work started for the default thread,
|
||||
// But React shouldn't notify until it's been flushed.
|
||||
expect(getWorkForReactThreads(onWorkStarted)).toHaveLength(0);
|
||||
expect(getWorkForReactThreads(onWorkStopped)).toHaveLength(0);
|
||||
|
|
@ -1518,7 +1518,7 @@ describe('Profiler', () => {
|
|||
// Update state again to verify our traced interaction isn't registered twice
|
||||
instance.setState({count: 2});
|
||||
|
||||
// The schedule/tracing package will notify of work started for the default thread,
|
||||
// The scheduler/tracing package will notify of work started for the default thread,
|
||||
// But React shouldn't notify until it's been flushed.
|
||||
expect(getWorkForReactThreads(onWorkStarted)).toHaveLength(0);
|
||||
expect(getWorkForReactThreads(onWorkStopped)).toHaveLength(0);
|
||||
|
|
@ -1621,7 +1621,7 @@ describe('Profiler', () => {
|
|||
);
|
||||
expect(onInteractionScheduledWorkCompleted).toHaveBeenCalledTimes(2);
|
||||
|
||||
// The schedule/tracing package will notify of work started for the default thread,
|
||||
// The scheduler/tracing package will notify of work started for the default thread,
|
||||
// But React shouldn't notify until it's been flushed.
|
||||
expect(getWorkForReactThreads(onWorkStarted)).toHaveLength(0);
|
||||
expect(getWorkForReactThreads(onWorkStopped)).toHaveLength(0);
|
||||
|
|
@ -1799,7 +1799,7 @@ describe('Profiler', () => {
|
|||
expect(onInteractionScheduledWorkCompleted).toHaveBeenCalledTimes(1);
|
||||
|
||||
// Work might be started multiple times before being completed.
|
||||
// This is okay; it's part of the schedule/tracing contract.
|
||||
// This is okay; it's part of the scheduler/tracing contract.
|
||||
expect(getWorkForReactThreads(onWorkStarted)).toHaveLength(3);
|
||||
expect(getWorkForReactThreads(onWorkStarted)[1][0]).toMatchInteractions(
|
||||
[interactionLowPri, interactionHighPri],
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ describe('ReactProfiler DevTools integration', () => {
|
|||
ReactFeatureFlags = require('shared/ReactFeatureFlags');
|
||||
ReactFeatureFlags.enableProfilerTimer = true;
|
||||
ReactFeatureFlags.enableSchedulerTracing = true;
|
||||
SchedulerTracing = require('schedule/tracing');
|
||||
SchedulerTracing = require('scheduler/tracing');
|
||||
React = require('react');
|
||||
ReactTestRenderer = require('react-test-renderer');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/schedule.production.min.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/schedule.development.js');
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/schedule-tracing.profiling.min.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/schedule-tracing.development.js');
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/schedule-tracing.production.min.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/schedule-tracing.development.js');
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# `schedule`
|
||||
# `scheduler`
|
||||
|
||||
This is a package for cooperative scheduling in a browser environment. It is currently used internally by React, but we plan to make it more generic.
|
||||
|
||||
|
|
@ -6,4 +6,4 @@ The public API for this package is not yet finalized.
|
|||
|
||||
### Thanks
|
||||
|
||||
The React team thanks [Haoliang Gao](https://github.com/popomore) for donating the `schedule` package name.
|
||||
The React team thanks [Anton Podviaznikov](https://podviaznikov.com/) for donating the `scheduler` package name.
|
||||
|
|
@ -7,4 +7,4 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
export * from './src/Schedule';
|
||||
export * from './src/Scheduler';
|
||||
7
packages/scheduler/npm/index.js
Normal file
7
packages/scheduler/npm/index.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/scheduler.production.min.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/scheduler.development.js');
|
||||
}
|
||||
7
packages/scheduler/npm/tracing-profiling.js
Normal file
7
packages/scheduler/npm/tracing-profiling.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/scheduler-tracing.profiling.min.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/scheduler-tracing.development.js');
|
||||
}
|
||||
7
packages/scheduler/npm/tracing.js
Normal file
7
packages/scheduler/npm/tracing.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/scheduler-tracing.production.min.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/scheduler-tracing.development.js');
|
||||
}
|
||||
|
|
@ -14,24 +14,24 @@
|
|||
? (module.exports = factory(require('react')))
|
||||
: typeof define === 'function' && define.amd // eslint-disable-line no-undef
|
||||
? define(['react'], factory) // eslint-disable-line no-undef
|
||||
: (global.ScheduleTracing = factory(global));
|
||||
: (global.SchedulerTracing = factory(global));
|
||||
})(this, function(global) {
|
||||
function unstable_clear() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_clear.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_clear.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_getCurrent() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_getCurrent.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getCurrent.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_getThreadID() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_getThreadID.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getThreadID.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
|
|
@ -39,14 +39,14 @@
|
|||
|
||||
function unstable_subscribe() {
|
||||
// eslint-disable-next-line max-len
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_subscribe.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_subscribe.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_trace() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_trace.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_trace.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
|
|
@ -54,14 +54,14 @@
|
|||
|
||||
function unstable_unsubscribe() {
|
||||
// eslint-disable-next-line max-len
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_unsubscribe.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_unsubscribe.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_wrap() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_wrap.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_wrap.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
|
|
@ -14,24 +14,24 @@
|
|||
? (module.exports = factory(require('react')))
|
||||
: typeof define === 'function' && define.amd // eslint-disable-line no-undef
|
||||
? define(['react'], factory) // eslint-disable-line no-undef
|
||||
: (global.ScheduleTracing = factory(global));
|
||||
: (global.SchedulerTracing = factory(global));
|
||||
})(this, function(global) {
|
||||
function unstable_clear() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_clear.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_clear.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_getCurrent() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_getCurrent.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getCurrent.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_getThreadID() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_getThreadID.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getThreadID.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
|
|
@ -39,14 +39,14 @@
|
|||
|
||||
function unstable_subscribe() {
|
||||
// eslint-disable-next-line max-len
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_subscribe.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_subscribe.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_trace() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_trace.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_trace.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
|
|
@ -54,14 +54,14 @@
|
|||
|
||||
function unstable_unsubscribe() {
|
||||
// eslint-disable-next-line max-len
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_unsubscribe.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_unsubscribe.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_wrap() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_wrap.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_wrap.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
|
|
@ -14,24 +14,24 @@
|
|||
? (module.exports = factory(require('react')))
|
||||
: typeof define === 'function' && define.amd // eslint-disable-line no-undef
|
||||
? define(['react'], factory) // eslint-disable-line no-undef
|
||||
: (global.ScheduleTracing = factory(global));
|
||||
: (global.SchedulerTracing = factory(global));
|
||||
})(this, function(global) {
|
||||
function unstable_clear() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_clear.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_clear.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_getCurrent() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_getCurrent.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getCurrent.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_getThreadID() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_getThreadID.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getThreadID.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
|
|
@ -39,14 +39,14 @@
|
|||
|
||||
function unstable_subscribe() {
|
||||
// eslint-disable-next-line max-len
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_subscribe.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_subscribe.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_trace() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_trace.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_trace.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
|
|
@ -54,14 +54,14 @@
|
|||
|
||||
function unstable_unsubscribe() {
|
||||
// eslint-disable-next-line max-len
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_unsubscribe.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_unsubscribe.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_wrap() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_wrap.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_wrap.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
|
|
@ -14,24 +14,24 @@
|
|||
? (module.exports = factory(require('react')))
|
||||
: typeof define === 'function' && define.amd // eslint-disable-line no-undef
|
||||
? define(['react'], factory) // eslint-disable-line no-undef
|
||||
: (global.Schedule = factory(global));
|
||||
: (global.Scheduler = factory(global));
|
||||
})(this, function(global) {
|
||||
function unstable_now() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_now.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_scheduleWork() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_scheduleWork.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleWork.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_cancelScheduledWork() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_cancelScheduledWork.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_cancelScheduledWork.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
|
|
@ -14,24 +14,24 @@
|
|||
? (module.exports = factory(require('react')))
|
||||
: typeof define === 'function' && define.amd // eslint-disable-line no-undef
|
||||
? define(['react'], factory) // eslint-disable-line no-undef
|
||||
: (global.Schedule = factory(global));
|
||||
: (global.Scheduler = factory(global));
|
||||
})(this, function(global) {
|
||||
function unstable_now() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_now.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_scheduleWork() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_scheduleWork.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleWork.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_cancelScheduledWork() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_cancelScheduledWork.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_cancelScheduledWork.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
|
|
@ -14,24 +14,24 @@
|
|||
? (module.exports = factory(require('react')))
|
||||
: typeof define === 'function' && define.amd // eslint-disable-line no-undef
|
||||
? define(['react'], factory) // eslint-disable-line no-undef
|
||||
: (global.Schedule = factory(global));
|
||||
: (global.Scheduler = factory(global));
|
||||
})(this, function(global) {
|
||||
function unstable_now() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_now.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_scheduleWork() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_scheduleWork.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleWork.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
}
|
||||
|
||||
function unstable_cancelScheduledWork() {
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_cancelScheduledWork.apply(
|
||||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_cancelScheduledWork.apply(
|
||||
this,
|
||||
arguments
|
||||
);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "schedule",
|
||||
"version": "0.5.0",
|
||||
"name": "scheduler",
|
||||
"version": "0.9.0",
|
||||
"description": "Cooperative scheduler for the browser environment.",
|
||||
"main": "index.js",
|
||||
"repository": "facebook/react",
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
import type {Interaction, Subscriber} from './Tracing';
|
||||
|
||||
import {enableSchedulerTracing} from 'shared/ReactFeatureFlags';
|
||||
import {__subscriberRef} from 'schedule/tracing';
|
||||
import {__subscriberRef} from 'scheduler/tracing';
|
||||
|
||||
let subscribers: Set<Subscriber> = (null: any);
|
||||
if (enableSchedulerTracing) {
|
||||
|
|
@ -18,7 +18,7 @@ let yieldedValues;
|
|||
let yieldValue;
|
||||
let clearYieldedValues;
|
||||
|
||||
describe('Schedule', () => {
|
||||
describe('Scheduler', () => {
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers();
|
||||
jest.resetModules();
|
||||
|
|
@ -94,9 +94,9 @@ describe('Schedule', () => {
|
|||
global.Date.now = () => currentTime;
|
||||
window._schedMock = [requestCallback, cancelCallback, getTimeRemaining];
|
||||
|
||||
const Schedule = require('schedule');
|
||||
scheduleWork = Schedule.unstable_scheduleWork;
|
||||
cancelScheduledWork = Schedule.unstable_cancelScheduledWork;
|
||||
const Scheduler = require('scheduler');
|
||||
scheduleWork = Scheduler.unstable_scheduleWork;
|
||||
cancelScheduledWork = Scheduler.unstable_cancelScheduledWork;
|
||||
});
|
||||
|
||||
it('flushes work incrementally', () => {
|
||||
|
|
@ -9,14 +9,14 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
let Schedule;
|
||||
let Scheduler;
|
||||
type FrameTimeoutConfigType = {
|
||||
// should only specify one or the other
|
||||
timeLeftInFrame: ?number,
|
||||
timePastFrameDeadline: ?number,
|
||||
};
|
||||
|
||||
describe('ScheduleDOM', () => {
|
||||
describe('SchedulerDOM', () => {
|
||||
let rAFCallbacks = [];
|
||||
let postMessageCallback;
|
||||
let postMessageEvents = [];
|
||||
|
|
@ -94,12 +94,12 @@ describe('ScheduleDOM', () => {
|
|||
return currentTime;
|
||||
};
|
||||
jest.resetModules();
|
||||
Schedule = require('schedule');
|
||||
Scheduler = require('scheduler');
|
||||
});
|
||||
|
||||
describe('scheduleWork', () => {
|
||||
it('calls the callback within the frame when not blocked', () => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
const cb = jest.fn();
|
||||
scheduleWork(cb);
|
||||
advanceOneFrame({timeLeftInFrame: 15});
|
||||
|
|
@ -111,7 +111,7 @@ describe('ScheduleDOM', () => {
|
|||
|
||||
describe('with multiple callbacks', () => {
|
||||
it('accepts multiple callbacks and calls within frame when not blocked', () => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
const callbackLog = [];
|
||||
const callbackA = jest.fn(() => callbackLog.push('A'));
|
||||
const callbackB = jest.fn(() => callbackLog.push('B'));
|
||||
|
|
@ -137,7 +137,7 @@ describe('ScheduleDOM', () => {
|
|||
});
|
||||
|
||||
it("accepts callbacks betweeen animationFrame and postMessage and doesn't stall", () => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
const callbackLog = [];
|
||||
const callbackA = jest.fn(() => callbackLog.push('A'));
|
||||
const callbackB = jest.fn(() => callbackLog.push('B'));
|
||||
|
|
@ -167,7 +167,7 @@ describe('ScheduleDOM', () => {
|
|||
'schedules callbacks in correct order and' +
|
||||
'keeps calling them if there is time',
|
||||
() => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
const callbackLog = [];
|
||||
const callbackA = jest.fn(() => {
|
||||
callbackLog.push('A');
|
||||
|
|
@ -194,7 +194,7 @@ describe('ScheduleDOM', () => {
|
|||
);
|
||||
|
||||
it('schedules callbacks in correct order when callbacks have many nested scheduleWork calls', () => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
const callbackLog = [];
|
||||
const callbackA = jest.fn(() => {
|
||||
callbackLog.push('A');
|
||||
|
|
@ -229,7 +229,7 @@ describe('ScheduleDOM', () => {
|
|||
});
|
||||
|
||||
it('schedules callbacks in correct order when they use scheduleWork to schedule themselves', () => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
const callbackLog = [];
|
||||
let callbackAIterations = 0;
|
||||
const callbackA = jest.fn(() => {
|
||||
|
|
@ -260,7 +260,7 @@ describe('ScheduleDOM', () => {
|
|||
|
||||
describe('when there is no more time left in the frame', () => {
|
||||
it('calls any callback which has timed out, waits for others', () => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
startOfLatestFrame = 1000000000000;
|
||||
currentTime = startOfLatestFrame - 10;
|
||||
const callbackLog = [];
|
||||
|
|
@ -295,7 +295,7 @@ describe('ScheduleDOM', () => {
|
|||
|
||||
describe('when there is some time left in the frame', () => {
|
||||
it('calls timed out callbacks and then any more pending callbacks, defers others if time runs out', () => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
startOfLatestFrame = 1000000000000;
|
||||
currentTime = startOfLatestFrame - 10;
|
||||
const callbackLog = [];
|
||||
|
|
@ -346,7 +346,7 @@ describe('ScheduleDOM', () => {
|
|||
const {
|
||||
unstable_scheduleWork: scheduleWork,
|
||||
unstable_cancelScheduledWork: cancelScheduledWork,
|
||||
} = Schedule;
|
||||
} = Scheduler;
|
||||
const cb = jest.fn();
|
||||
const callbackId = scheduleWork(cb);
|
||||
expect(cb).toHaveBeenCalledTimes(0);
|
||||
|
|
@ -360,7 +360,7 @@ describe('ScheduleDOM', () => {
|
|||
const {
|
||||
unstable_scheduleWork: scheduleWork,
|
||||
unstable_cancelScheduledWork: cancelScheduledWork,
|
||||
} = Schedule;
|
||||
} = Scheduler;
|
||||
const callbackLog = [];
|
||||
const callbackA = jest.fn(() => callbackLog.push('A'));
|
||||
const callbackB = jest.fn(() => callbackLog.push('B'));
|
||||
|
|
@ -384,7 +384,7 @@ describe('ScheduleDOM', () => {
|
|||
const {
|
||||
unstable_scheduleWork: scheduleWork,
|
||||
unstable_cancelScheduledWork: cancelScheduledWork,
|
||||
} = Schedule;
|
||||
} = Scheduler;
|
||||
const callbackLog = [];
|
||||
let callbackBId;
|
||||
const callbackA = jest.fn(() => {
|
||||
|
|
@ -421,7 +421,7 @@ describe('ScheduleDOM', () => {
|
|||
*
|
||||
*/
|
||||
it('still calls all callbacks within same frame', () => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
const callbackLog = [];
|
||||
const callbackA = jest.fn(() => callbackLog.push('A'));
|
||||
const callbackB = jest.fn(() => {
|
||||
|
|
@ -467,7 +467,7 @@ describe('ScheduleDOM', () => {
|
|||
*
|
||||
*/
|
||||
it('and with some timed out callbacks, still calls all callbacks within same frame', () => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
const callbackLog = [];
|
||||
const callbackA = jest.fn(() => {
|
||||
callbackLog.push('A');
|
||||
|
|
@ -513,7 +513,7 @@ describe('ScheduleDOM', () => {
|
|||
*
|
||||
*/
|
||||
it('still calls all callbacks within same frame', () => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
const callbackLog = [];
|
||||
const callbackA = jest.fn(() => {
|
||||
callbackLog.push('A');
|
||||
|
|
@ -574,7 +574,7 @@ describe('ScheduleDOM', () => {
|
|||
*
|
||||
*/
|
||||
it('and with all timed out callbacks, still calls all callbacks within same frame', () => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
const callbackLog = [];
|
||||
const callbackA = jest.fn(() => {
|
||||
callbackLog.push('A');
|
||||
|
|
@ -655,7 +655,7 @@ describe('ScheduleDOM', () => {
|
|||
*
|
||||
*/
|
||||
it('still calls all callbacks within same frame', () => {
|
||||
const {unstable_scheduleWork: scheduleWork} = Schedule;
|
||||
const {unstable_scheduleWork: scheduleWork} = Scheduler;
|
||||
startOfLatestFrame = 1000000000000;
|
||||
currentTime = startOfLatestFrame - 10;
|
||||
catchPostMessageErrors = true;
|
||||
|
|
@ -35,29 +35,29 @@ describe('Scheduling UMD bundle', () => {
|
|||
|
||||
it('should define the same scheduling API', () => {
|
||||
const api = require('../../index');
|
||||
const umdAPIDev = require('../../npm/umd/schedule.development');
|
||||
const umdAPIProd = require('../../npm/umd/schedule.production.min');
|
||||
const umdAPIProfiling = require('../../npm/umd/schedule.profiling.min');
|
||||
const umdAPIDev = require('../../npm/umd/scheduler.development');
|
||||
const umdAPIProd = require('../../npm/umd/scheduler.production.min');
|
||||
const umdAPIProfiling = require('../../npm/umd/scheduler.profiling.min');
|
||||
const secretAPI = require('react/src/ReactSharedInternals').default;
|
||||
validateForwardedAPIs(api, [
|
||||
umdAPIDev,
|
||||
umdAPIProd,
|
||||
umdAPIProfiling,
|
||||
secretAPI.Schedule,
|
||||
secretAPI.Scheduler,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should define the same tracing API', () => {
|
||||
const api = require('../../tracing');
|
||||
const umdAPIDev = require('../../npm/umd/schedule-tracing.development');
|
||||
const umdAPIProd = require('../../npm/umd/schedule-tracing.production.min');
|
||||
const umdAPIProfiling = require('../../npm/umd/schedule-tracing.profiling.min');
|
||||
const umdAPIDev = require('../../npm/umd/scheduler-tracing.development');
|
||||
const umdAPIProd = require('../../npm/umd/scheduler-tracing.production.min');
|
||||
const umdAPIProfiling = require('../../npm/umd/scheduler-tracing.profiling.min');
|
||||
const secretAPI = require('react/src/ReactSharedInternals').default;
|
||||
validateForwardedAPIs(api, [
|
||||
umdAPIDev,
|
||||
umdAPIProd,
|
||||
umdAPIProfiling,
|
||||
secretAPI.ScheduleTracing,
|
||||
secretAPI.SchedulerTracing,
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
@ -29,7 +29,7 @@ describe('Tracing', () => {
|
|||
ReactFeatureFlags = require('shared/ReactFeatureFlags');
|
||||
ReactFeatureFlags.enableSchedulerTracing = enableSchedulerTracing;
|
||||
|
||||
SchedulerTracing = require('schedule/tracing');
|
||||
SchedulerTracing = require('scheduler/tracing');
|
||||
}
|
||||
|
||||
describe('enableSchedulerTracing enabled', () => {
|
||||
|
|
@ -14,7 +14,7 @@ describe('Tracing', () => {
|
|||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
|
||||
SchedulerTracing = require('schedule/tracing');
|
||||
SchedulerTracing = require('scheduler/tracing');
|
||||
});
|
||||
|
||||
it('should return the value of a traced function', () => {
|
||||
|
|
@ -42,7 +42,7 @@ describe('TracingSubscriptions', () => {
|
|||
ReactFeatureFlags = require('shared/ReactFeatureFlags');
|
||||
ReactFeatureFlags.enableSchedulerTracing = enableSchedulerTracing;
|
||||
|
||||
SchedulerTracing = require('schedule/tracing');
|
||||
SchedulerTracing = require('scheduler/tracing');
|
||||
|
||||
throwInOnInteractionScheduledWorkCompleted = false;
|
||||
throwInOnInteractionTraced = false;
|
||||
|
|
@ -15,6 +15,6 @@ const {
|
|||
unstable_cancelScheduledWork,
|
||||
unstable_now,
|
||||
unstable_scheduleWork,
|
||||
} = ReactInternals.Schedule;
|
||||
} = ReactInternals.Scheduler;
|
||||
|
||||
export {unstable_cancelScheduledWork, unstable_now, unstable_scheduleWork};
|
||||
|
|
@ -21,7 +21,7 @@ const {
|
|||
unstable_trace,
|
||||
unstable_unsubscribe,
|
||||
unstable_wrap,
|
||||
} = ReactInternals.ScheduleTracing;
|
||||
} = ReactInternals.SchedulerTracing;
|
||||
|
||||
export {
|
||||
__interactionsRef,
|
||||
|
|
@ -385,16 +385,16 @@ const bundles = [
|
|||
|
||||
/******* React Scheduler (experimental) *******/
|
||||
{
|
||||
label: 'schedule',
|
||||
label: 'scheduler',
|
||||
bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV, FB_WWW_PROD],
|
||||
moduleType: ISOMORPHIC,
|
||||
entry: 'schedule',
|
||||
global: 'Schedule',
|
||||
entry: 'scheduler',
|
||||
global: 'Scheduler',
|
||||
externals: [],
|
||||
},
|
||||
|
||||
{
|
||||
label: 'schedule-tracing',
|
||||
label: 'scheduler-tracing',
|
||||
bundleTypes: [
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
|
|
@ -404,8 +404,8 @@ const bundles = [
|
|||
NODE_PROFILING,
|
||||
],
|
||||
moduleType: ISOMORPHIC,
|
||||
entry: 'schedule/tracing',
|
||||
global: 'ScheduleTracing',
|
||||
entry: 'scheduler/tracing',
|
||||
global: 'SchedulerTracing',
|
||||
externals: [],
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ const forks = Object.freeze({
|
|||
return null;
|
||||
},
|
||||
|
||||
schedule: (bundleType, entry, dependencies) => {
|
||||
scheduler: (bundleType, entry, dependencies) => {
|
||||
switch (bundleType) {
|
||||
case UMD_DEV:
|
||||
case UMD_PROD:
|
||||
|
|
@ -131,14 +131,14 @@ const forks = Object.freeze({
|
|||
}
|
||||
// Optimization: for UMDs, use the API that is already a part of the React
|
||||
// package instead of requiring it to be loaded via a separate <script> tag
|
||||
return 'shared/forks/Schedule.umd.js';
|
||||
return 'shared/forks/Scheduler.umd.js';
|
||||
default:
|
||||
// For other bundles, use the shared NPM package.
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
'schedule/tracing': (bundleType, entry, dependencies) => {
|
||||
'scheduler/tracing': (bundleType, entry, dependencies) => {
|
||||
switch (bundleType) {
|
||||
case UMD_DEV:
|
||||
case UMD_PROD:
|
||||
|
|
@ -150,7 +150,7 @@ const forks = Object.freeze({
|
|||
}
|
||||
// Optimization: for UMDs, use the API that is already a part of the React
|
||||
// package instead of requiring it to be loaded via a separate <script> tag
|
||||
return 'shared/forks/ScheduleTracing.umd.js';
|
||||
return 'shared/forks/SchedulerTracing.umd.js';
|
||||
default:
|
||||
// For other bundles, use the shared NPM package.
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -15,16 +15,16 @@ const HAS_NO_SIDE_EFFECTS_ON_IMPORT = false;
|
|||
const importSideEffects = Object.freeze({
|
||||
'prop-types/checkPropTypes': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
deepFreezeAndThrowOnMutationInDev: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
schedule: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
'schedule/tracing': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
scheduler: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
'scheduler/tracing': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
});
|
||||
|
||||
// Bundles exporting globals that other modules rely on.
|
||||
const knownGlobals = Object.freeze({
|
||||
react: 'React',
|
||||
'react-dom': 'ReactDOM',
|
||||
schedule: 'Schedule',
|
||||
'schedule/tracing': 'ScheduleTracing',
|
||||
scheduler: 'Scheduler',
|
||||
'scheduler/tracing': 'SchedulerTracing',
|
||||
});
|
||||
|
||||
// Given ['react'] in bundle externals, returns { 'react': 'React' }.
|
||||
|
|
|
|||
|
|
@ -659,30 +659,30 @@
|
|||
"gzip": 1013
|
||||
},
|
||||
{
|
||||
"filename": "schedule.development.js",
|
||||
"filename": "scheduler.development.js",
|
||||
"bundleType": "UMD_DEV",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 19628,
|
||||
"gzip": 5881
|
||||
},
|
||||
{
|
||||
"filename": "schedule.production.min.js",
|
||||
"filename": "scheduler.production.min.js",
|
||||
"bundleType": "UMD_PROD",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 3233,
|
||||
"gzip": 1562
|
||||
},
|
||||
{
|
||||
"filename": "schedule.development.js",
|
||||
"filename": "scheduler.development.js",
|
||||
"bundleType": "NODE_DEV",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 14175,
|
||||
"gzip": 4343
|
||||
},
|
||||
{
|
||||
"filename": "schedule.production.min.js",
|
||||
"filename": "scheduler.production.min.js",
|
||||
"bundleType": "NODE_PROD",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 3260,
|
||||
"gzip": 1428
|
||||
},
|
||||
|
|
@ -736,16 +736,16 @@
|
|||
"gzip": 36778
|
||||
},
|
||||
{
|
||||
"filename": "Schedule-dev.js",
|
||||
"filename": "Scheduler-dev.js",
|
||||
"bundleType": "FB_WWW_DEV",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 14361,
|
||||
"gzip": 4374
|
||||
},
|
||||
{
|
||||
"filename": "Schedule-prod.js",
|
||||
"filename": "Scheduler-prod.js",
|
||||
"bundleType": "FB_WWW_PROD",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 8327,
|
||||
"gzip": 2105
|
||||
},
|
||||
|
|
@ -785,44 +785,44 @@
|
|||
"gzip": 36760
|
||||
},
|
||||
{
|
||||
"filename": "schedule-tracking.development.js",
|
||||
"filename": "scheduler-tracking.development.js",
|
||||
"bundleType": "NODE_DEV",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 10514,
|
||||
"gzip": 2411
|
||||
},
|
||||
{
|
||||
"filename": "schedule-tracking.production.min.js",
|
||||
"filename": "scheduler-tracking.production.min.js",
|
||||
"bundleType": "NODE_PROD",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 719,
|
||||
"gzip": 374
|
||||
},
|
||||
{
|
||||
"filename": "schedule-tracking.profiling.min.js",
|
||||
"filename": "scheduler-tracking.profiling.min.js",
|
||||
"bundleType": "NODE_PROFILING",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 3337,
|
||||
"gzip": 992
|
||||
},
|
||||
{
|
||||
"filename": "ScheduleTracking-dev.js",
|
||||
"filename": "SchedulerTracking-dev.js",
|
||||
"bundleType": "FB_WWW_DEV",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 10608,
|
||||
"gzip": 2330
|
||||
},
|
||||
{
|
||||
"filename": "ScheduleTracking-prod.js",
|
||||
"filename": "SchedulerTracking-prod.js",
|
||||
"bundleType": "FB_WWW_PROD",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 899,
|
||||
"gzip": 425
|
||||
},
|
||||
{
|
||||
"filename": "ScheduleTracking-profiling.js",
|
||||
"filename": "SchedulerTracking-profiling.js",
|
||||
"bundleType": "FB_WWW_PROFILING",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 6984,
|
||||
"gzip": 1258
|
||||
},
|
||||
|
|
@ -841,44 +841,44 @@
|
|||
"gzip": 31534
|
||||
},
|
||||
{
|
||||
"filename": "schedule-tracing.development.js",
|
||||
"filename": "scheduler-tracing.development.js",
|
||||
"bundleType": "NODE_DEV",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 10496,
|
||||
"gzip": 2410
|
||||
},
|
||||
{
|
||||
"filename": "schedule-tracing.production.min.js",
|
||||
"filename": "scheduler-tracing.production.min.js",
|
||||
"bundleType": "NODE_PROD",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 718,
|
||||
"gzip": 374
|
||||
},
|
||||
{
|
||||
"filename": "schedule-tracing.profiling.min.js",
|
||||
"filename": "scheduler-tracing.profiling.min.js",
|
||||
"bundleType": "NODE_PROFILING",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 3333,
|
||||
"gzip": 991
|
||||
},
|
||||
{
|
||||
"filename": "ScheduleTracing-dev.js",
|
||||
"filename": "SchedulerTracing-dev.js",
|
||||
"bundleType": "FB_WWW_DEV",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 10591,
|
||||
"gzip": 2327
|
||||
},
|
||||
{
|
||||
"filename": "ScheduleTracing-prod.js",
|
||||
"filename": "SchedulerTracing-prod.js",
|
||||
"bundleType": "FB_WWW_PROD",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 899,
|
||||
"gzip": 425
|
||||
},
|
||||
{
|
||||
"filename": "ScheduleTracing-profiling.js",
|
||||
"filename": "SchedulerTracing-profiling.js",
|
||||
"bundleType": "FB_WWW_PROFILING",
|
||||
"packageName": "schedule",
|
||||
"packageName": "scheduler",
|
||||
"size": 6979,
|
||||
"gzip": 1257
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user