Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Refactor Schedule, remove React-isms
Once the API stabilizes, we will move Schedule this into a separate
repo. To promote adoption, especially by projects outside the React
ecosystem, we'll remove all React-isms from the source and keep it as
simple as possible:

- No build step.
- No static types.
- Everything is in a single file.

If we end up needing to support multiple targets, like CommonJS and ESM,
we can still avoid a build step by maintaining two copies of the same
file, but with different exports.

This commit also refactors the implementation to split out the DOM-
specific parts (essentially a requestIdleCallback polyfill). Aside from
the architectural benefits, this also makes it possible to write host-
agnostic tests. If/when we publish a version of Schedule that targets
other environments, like React Native, we can run these same tests
across all implementations.
  • Loading branch information
acdlite committed Sep 12, 2018
commit 7c4ff13a296a5a18a0dbdae59df2f7d8b8735bb5
6 changes: 4 additions & 2 deletions packages/react-dom/src/__tests__/ReactDOM-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,11 @@ describe('ReactDOM', () => {
try {
delete global.requestAnimationFrame;
jest.resetModules();
expect(() => require('react-dom')).toWarnDev(
spyOnDevAndProd(console, 'error');
require('react-dom');
expect(console.error.calls.count()).toEqual(1);
expect(console.error.calls.argsFor(0)[0]).toMatch(
"This browser doesn't support requestAnimationFrame.",
{withoutStack: true},
);
} finally {
global.requestAnimationFrame = previousRAF;
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ import {
import {Dispatcher} from './ReactFiberDispatcher';

export type Deadline = {
timeRemaining: () => number,
timeRemaining(): number,
didTimeout: boolean,
};

Expand Down
2 changes: 0 additions & 2 deletions packages/schedule/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

'use strict';
Expand Down
Loading