Inline requires in JSTimers

Reviewed By: javache

Differential Revision: D5466322

fbshipit-source-id: 0bcc71e19cdb48d95b5e35ae2f720d46baf9bb50
This commit is contained in:
Alex Dvornikov 2017-07-24 07:09:41 -07:00 committed by Facebook Github Bot
parent 5da7629b44
commit 9342f25d5f
1 changed files with 9 additions and 4 deletions

View File

@ -16,13 +16,18 @@ const Platform = require('Platform');
const Systrace = require('Systrace'); const Systrace = require('Systrace');
const invariant = require('fbjs/lib/invariant'); const invariant = require('fbjs/lib/invariant');
const performanceNow = require('fbjs/lib/performanceNow');
const warning = require('fbjs/lib/warning');
const {Timing} = require('NativeModules'); const {Timing} = require('NativeModules');
import type {ExtendedError} from 'parseErrorStack'; import type {ExtendedError} from 'parseErrorStack';
let _performanceNow = null;
function performanceNow() {
if (!_performanceNow) {
_performanceNow = require('fbjs/lib/performanceNow');
}
return _performanceNow();
}
/** /**
* JS implementation of timer functions. Must be completely driven by an * JS implementation of timer functions. Must be completely driven by an
* external clock signal, all that's stored here is timerID, timer type, and * external clock signal, all that's stored here is timerID, timer type, and
@ -96,7 +101,7 @@ function _allocateCallback(func: Function, type: JSTimerType): number {
* recurring (setInterval). * recurring (setInterval).
*/ */
function _callTimer(timerID: number, frameTime: number, didTimeout: ?boolean) { function _callTimer(timerID: number, frameTime: number, didTimeout: ?boolean) {
warning( require('fbjs/lib/warning')(
timerID <= GUID, timerID <= GUID,
'Tried to call timer with ID %s but no such timer exists.', 'Tried to call timer with ID %s but no such timer exists.',
timerID, timerID,