Skip to content

Commit

Permalink
Refactor Schedule, remove React-isms
Browse files Browse the repository at this point in the history
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 6, 2018
1 parent d66505d commit 84f2fe0
Show file tree
Hide file tree
Showing 5 changed files with 509 additions and 362 deletions.
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

0 comments on commit 84f2fe0

Please sign in to comment.