-
public class JavaTimerManager
This class is the native implementation for JS timer execution on Android. It schedules JS timers to be invoked on frame boundaries using ReactChoreographer.
This is used by the NativeModule TimingModule.
-
-
Constructor Summary
Constructors Constructor Description JavaTimerManager(ReactApplicationContext reactContext, JavaScriptTimerExecutor javaScriptTimerManager, ReactChoreographer reactChoreographer, DevSupportManager devSupportManager)
-
Method Summary
Modifier and Type Method Description void
onHostPause()
void
onHostDestroy()
void
onHostResume()
void
onHeadlessJsTaskStart(int taskId)
void
onHeadlessJsTaskFinish(int taskId)
void
onInstanceDestroy()
void
createTimer(int callbackID, long delay, boolean repeat)
A method to be used for synchronously creating a timer. void
createAndMaybeCallTimer(int callbackID, int duration, double jsSchedulingTime, boolean repeat)
A method to be used for asynchronously creating a timer. void
deleteTimer(int timerId)
void
setSendIdleEvents(boolean sendIdleEvents)
-
-
Constructor Detail
-
JavaTimerManager
JavaTimerManager(ReactApplicationContext reactContext, JavaScriptTimerExecutor javaScriptTimerManager, ReactChoreographer reactChoreographer, DevSupportManager devSupportManager)
-
-
Method Detail
-
onHostPause
void onHostPause()
-
onHostDestroy
void onHostDestroy()
-
onHostResume
void onHostResume()
-
onHeadlessJsTaskStart
void onHeadlessJsTaskStart(int taskId)
-
onHeadlessJsTaskFinish
void onHeadlessJsTaskFinish(int taskId)
-
onInstanceDestroy
void onInstanceDestroy()
-
createTimer
void createTimer(int callbackID, long delay, boolean repeat)
A method to be used for synchronously creating a timer. The timer will not be invoked until thenext frame, regardless of whether it has already expired (i.e. the delay is 0).
- Parameters:
callbackID
- An identifier for the callback that can be passed to JS or C++ to invoke it.delay
- The time in ms before the callback should be invoked.repeat
- Whether the timer should be repeated (used for setInterval).
-
createAndMaybeCallTimer
void createAndMaybeCallTimer(int callbackID, int duration, double jsSchedulingTime, boolean repeat)
A method to be used for asynchronously creating a timer. If the timer has already expired,(based on the provided jsSchedulingTime) then it will be immediately invoked.
- Parameters:
callbackID
- An identifier that can be passed back to JS to invoke the callback.duration
- The time in ms before the callback should be invoked.jsSchedulingTime
- The time (ms since epoch) when this timer was created in JS.repeat
- Whether the timer should be repeated (used for setInterval)
-
deleteTimer
void deleteTimer(int timerId)
-
setSendIdleEvents
void setSendIdleEvents(boolean sendIdleEvents)
-
-
-
-