[RFC][ReactNative] increase timer resolution
This commit is contained in:
parent
9086365faf
commit
efd56688ba
|
@ -90,7 +90,7 @@ var JSTimers = {
|
|||
JSTimersExecution.timerIDs[freeIndex] = newID;
|
||||
JSTimersExecution.callbacks[freeIndex] = func;
|
||||
JSTimersExecution.types[freeIndex] = JSTimersExecution.Type.requestAnimationFrame;
|
||||
RCTTiming.createTimer(newID, 0, Date.now(), /** recurring */ false);
|
||||
RCTTiming.createTimer(newID, 1, Date.now(), /** recurring */ false);
|
||||
return newID;
|
||||
},
|
||||
|
||||
|
|
|
@ -166,6 +166,12 @@
|
|||
{
|
||||
RCT_EXPORT();
|
||||
|
||||
if (jsDuration == 0 && repeats == NO) {
|
||||
// For super fast, one-off timers, just enqueue them immediately rather than waiting a frame.
|
||||
[_bridge enqueueJSCall:@"RCTJSTimers.callTimers" args:@[@[callbackID]]];
|
||||
return;
|
||||
}
|
||||
|
||||
NSTimeInterval interval = jsDuration / 1000;
|
||||
NSTimeInterval jsCreationTimeSinceUnixEpoch = jsSchedulingTime / 1000;
|
||||
NSTimeInterval currentTimeSinceUnixEpoch = [[NSDate date] timeIntervalSince1970];
|
||||
|
|
Loading…
Reference in New Issue