|
|
|
@ -290,6 +290,9 @@ const JSTimers = {
|
|
|
|
|
* @param {function} func Callback to be invoked before the end of the
|
|
|
|
|
* current JavaScript execution loop.
|
|
|
|
|
*/
|
|
|
|
|
/* $FlowFixMe(>=0.79.1 site=react_native_fb) This comment suppresses an
|
|
|
|
|
* error found when Flow v0.79 was deployed. To see the error delete this
|
|
|
|
|
* comment and run Flow. */
|
|
|
|
|
setImmediate: function(func: Function, ...args: any) {
|
|
|
|
|
const id = _allocateCallback(
|
|
|
|
|
() => func.apply(undefined, args),
|
|
|
|
@ -302,6 +305,9 @@ const JSTimers = {
|
|
|
|
|
/**
|
|
|
|
|
* @param {function} func Callback to be invoked every frame.
|
|
|
|
|
*/
|
|
|
|
|
/* $FlowFixMe(>=0.79.1 site=react_native_fb) This comment suppresses an
|
|
|
|
|
* error found when Flow v0.79 was deployed. To see the error delete this
|
|
|
|
|
* comment and run Flow. */
|
|
|
|
|
requestAnimationFrame: function(func: Function) {
|
|
|
|
|
const id = _allocateCallback(func, 'requestAnimationFrame');
|
|
|
|
|
Timing.createTimer(id, 1, Date.now(), /* recurring */ false);
|
|
|
|
@ -313,6 +319,9 @@ const JSTimers = {
|
|
|
|
|
* with time remaining in frame.
|
|
|
|
|
* @param {?object} options
|
|
|
|
|
*/
|
|
|
|
|
/* $FlowFixMe(>=0.79.1 site=react_native_fb) This comment suppresses an
|
|
|
|
|
* error found when Flow v0.79 was deployed. To see the error delete this
|
|
|
|
|
* comment and run Flow. */
|
|
|
|
|
requestIdleCallback: function(func: Function, options: ?Object) {
|
|
|
|
|
if (requestIdleCallbacks.length === 0) {
|
|
|
|
|
Timing.setSendIdleEvents(true);
|
|
|
|
@ -351,6 +360,9 @@ const JSTimers = {
|
|
|
|
|
return id;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/* $FlowFixMe(>=0.79.1 site=react_native_fb) This comment suppresses an
|
|
|
|
|
* error found when Flow v0.79 was deployed. To see the error delete this
|
|
|
|
|
* comment and run Flow. */
|
|
|
|
|
cancelIdleCallback: function(timerID: number) {
|
|
|
|
|
_freeCallback(timerID);
|
|
|
|
|
const index = requestIdleCallbacks.indexOf(timerID);
|
|
|
|
@ -369,14 +381,23 @@ const JSTimers = {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/* $FlowFixMe(>=0.79.1 site=react_native_fb) This comment suppresses an
|
|
|
|
|
* error found when Flow v0.79 was deployed. To see the error delete this
|
|
|
|
|
* comment and run Flow. */
|
|
|
|
|
clearTimeout: function(timerID: number) {
|
|
|
|
|
_freeCallback(timerID);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/* $FlowFixMe(>=0.79.1 site=react_native_fb) This comment suppresses an
|
|
|
|
|
* error found when Flow v0.79 was deployed. To see the error delete this
|
|
|
|
|
* comment and run Flow. */
|
|
|
|
|
clearInterval: function(timerID: number) {
|
|
|
|
|
_freeCallback(timerID);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/* $FlowFixMe(>=0.79.1 site=react_native_fb) This comment suppresses an
|
|
|
|
|
* error found when Flow v0.79 was deployed. To see the error delete this
|
|
|
|
|
* comment and run Flow. */
|
|
|
|
|
clearImmediate: function(timerID: number) {
|
|
|
|
|
_freeCallback(timerID);
|
|
|
|
|
const index = immediates.indexOf(timerID);
|
|
|
|
@ -385,6 +406,9 @@ const JSTimers = {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/* $FlowFixMe(>=0.79.1 site=react_native_fb) This comment suppresses an
|
|
|
|
|
* error found when Flow v0.79 was deployed. To see the error delete this
|
|
|
|
|
* comment and run Flow. */
|
|
|
|
|
cancelAnimationFrame: function(timerID: number) {
|
|
|
|
|
_freeCallback(timerID);
|
|
|
|
|
},
|
|
|
|
@ -393,6 +417,9 @@ const JSTimers = {
|
|
|
|
|
* This is called from the native side. We are passed an array of timerIDs,
|
|
|
|
|
* and
|
|
|
|
|
*/
|
|
|
|
|
/* $FlowFixMe(>=0.79.1 site=react_native_fb) This comment suppresses an
|
|
|
|
|
* error found when Flow v0.79 was deployed. To see the error delete this
|
|
|
|
|
* comment and run Flow. */
|
|
|
|
|
callTimers: function(timersToCall: Array<number>) {
|
|
|
|
|
invariant(
|
|
|
|
|
timersToCall.length !== 0,
|
|
|
|
@ -423,6 +450,9 @@ const JSTimers = {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/* $FlowFixMe(>=0.79.1 site=react_native_fb) This comment suppresses an
|
|
|
|
|
* error found when Flow v0.79 was deployed. To see the error delete this
|
|
|
|
|
* comment and run Flow. */
|
|
|
|
|
callIdleCallbacks: function(frameTime: number) {
|
|
|
|
|
if (
|
|
|
|
|
FRAME_DURATION - (performanceNow() - frameTime) <
|
|
|
|
@ -459,6 +489,9 @@ const JSTimers = {
|
|
|
|
|
* This is called after we execute any command we receive from native but
|
|
|
|
|
* before we hand control back to native.
|
|
|
|
|
*/
|
|
|
|
|
/* $FlowFixMe(>=0.79.1 site=react_native_fb) This comment suppresses an
|
|
|
|
|
* error found when Flow v0.79 was deployed. To see the error delete this
|
|
|
|
|
* comment and run Flow. */
|
|
|
|
|
callImmediates() {
|
|
|
|
|
errors = null;
|
|
|
|
|
while (_callImmediatesPass()) {}
|
|
|
|
@ -474,6 +507,9 @@ const JSTimers = {
|
|
|
|
|
/**
|
|
|
|
|
* Called from native (in development) when environment times are out-of-sync.
|
|
|
|
|
*/
|
|
|
|
|
/* $FlowFixMe(>=0.79.1 site=react_native_fb) This comment suppresses an
|
|
|
|
|
* error found when Flow v0.79 was deployed. To see the error delete this
|
|
|
|
|
* comment and run Flow. */
|
|
|
|
|
emitTimeDriftWarning(warningMessage: string) {
|
|
|
|
|
if (hasEmittedTimeDriftWarning) {
|
|
|
|
|
return;
|
|
|
|
|