diff --git a/Libraries/Core/Timers/JSTimers.js b/Libraries/Core/Timers/JSTimers.js index e2bca9fb2..73b6c1235 100644 --- a/Libraries/Core/Timers/JSTimers.js +++ b/Libraries/Core/Timers/JSTimers.js @@ -16,13 +16,18 @@ const Platform = require('Platform'); const Systrace = require('Systrace'); const invariant = require('fbjs/lib/invariant'); -const performanceNow = require('fbjs/lib/performanceNow'); -const warning = require('fbjs/lib/warning'); - const {Timing} = require('NativeModules'); 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 * 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). */ function _callTimer(timerID: number, frameTime: number, didTimeout: ?boolean) { - warning( + require('fbjs/lib/warning')( timerID <= GUID, 'Tried to call timer with ID %s but no such timer exists.', timerID,