-
Notifications
You must be signed in to change notification settings - Fork 47.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[scheduler] 4/n Allow splitting out schedule
in fb-www, prepare to fix polyfill issue internally
#12900
Merged
flarnie
merged 6 commits into
facebook:master
from
flarnie:useReferencesToGlobalsInScheduler
May 29, 2018
Merged
[scheduler] 4/n Allow splitting out schedule
in fb-www, prepare to fix polyfill issue internally
#12900
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7686bfc
Use local references to global things inside 'scheduler'
flarnie a96de36
Shim ReactScheduler for www
flarnie 01c7385
Generate a bundle for fb-www
flarnie adef206
ran prettier
flarnie 9c7b64d
fix rebase issues
flarnie 1320890
Change names of variables used for holding globals
flarnie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,17 @@ | ||
/** | ||
* 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'; | ||
import { | ||
now, | ||
scheduleWork, | ||
cancelScheduledWork, | ||
} from 'react-scheduler/src/ReactScheduler'; | ||
|
||
export {now, scheduleWork, cancelScheduledWork}; |
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,11 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
'use strict'; | ||
const {now, scheduleWork, cancelScheduledWork} = require('customSchedule'); | ||
|
||
export {now, scheduleWork, cancelScheduledWork}; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indirection seems a bit complicated :-(
Do we want to keep this fork long term? Is there a better fix in mind? How will this ultimately work in open source when the package is ready?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is complicated, agreed.
Here is my understanding of how it will work -
schedule
API is stable, we publish it as a separate module and make it a dependency ofreact-dom
andreact-art
. In OS people just pull in theschedule
bundle via npm, and it uses the nativerequestAnimationFrame
.It took a lot of discussion to agree on this solution, I'm hesitant to go back to the drawing board when we have something that works.
Regarding my original solution of just shimming 'requestAnimationFrame' itself in our 'www' build - @sebmarkbage had concerns that we should not be using the polyfilled version of 'requestAnimationFrame' at all in 'www', and that the best way to avoid pulling in the polyfill was to require the
schedule
module before the polyfilling happens.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, if we just wrap the 'callback' before we pass it into 'scheduleWork' at every single callsite, or even if we just expose a wrapped version of 'schedule' for non-React use within 'www', then I think we can still avoid a fork of 'schedule'. After we publish it as a separate module, that is.