-
Notifications
You must be signed in to change notification settings - Fork 47k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the first step - pulling the ReactDOMFrameScheduling module out into a separate package.
- Loading branch information
Showing
9 changed files
with
126 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# React Scheduler | ||
|
||
This is a work in progress - we are building a utility to better coordinate | ||
React and other JavaScript work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* 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'; | ||
|
||
export * from './src/ReactScheduler'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./cjs/react-scheduler.production.min.js'); | ||
} else { | ||
module.exports = require('./cjs/react-scheduler.development.js'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "react-scheduler", | ||
"version": "0.1.0-alpha-1", | ||
"private": true, | ||
"description": "unstable scheduling helper for coordinating React and other JS libraries", | ||
"main": "index.js", | ||
"repository": "facebook/react", | ||
"license": "MIT", | ||
"keywords": [ | ||
"react" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/facebook/react/issues" | ||
}, | ||
"homepage": "https://reactjs.org/", | ||
"files": [ | ||
"LICENSE", | ||
"README.md", | ||
"index.js", | ||
"cjs/", | ||
"umd/" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
packages/react-scheduler/src/__tests__/ReactScheduler-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @emails react-core | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// TODO: delete or change this test. | ||
describe('ReactDOMFrameScheduling', () => { | ||
it('warns when requestAnimationFrame is not polyfilled in the browser', () => { | ||
const previousRAF = global.requestAnimationFrame; | ||
try { | ||
global.requestAnimationFrame = undefined; | ||
jest.resetModules(); | ||
expect(() => require('react-dom')).toWarnDev( | ||
'React depends on requestAnimationFrame.', | ||
); | ||
} finally { | ||
global.requestAnimationFrame = previousRAF; | ||
} | ||
}); | ||
|
||
// We're just testing importing, not using it. | ||
// It is important because even isomorphic components may import it. | ||
it('can import findDOMNode in Node environment', () => { | ||
const previousRAF = global.requestAnimationFrame; | ||
const previousRIC = global.requestIdleCallback; | ||
const prevWindow = global.window; | ||
try { | ||
global.requestAnimationFrame = undefined; | ||
global.requestIdleCallback = undefined; | ||
// Simulate the Node environment: | ||
delete global.window; | ||
jest.resetModules(); | ||
expect(() => { | ||
require('react-dom'); | ||
}).not.toThrow(); | ||
} finally { | ||
global.requestAnimationFrame = previousRAF; | ||
global.requestIdleCallback = previousRIC; | ||
global.window = prevWindow; | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters