public final class Timing extends ReactContextBaseJavaModule implements LifecycleEventListener, OnExecutorUnregisteredListener
BaseJavaModule.JavaMethod, BaseJavaModule.SyncJavaHook
NativeModule.NativeMethod, NativeModule.SyncNativeHook
METHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC
Constructor and Description |
---|
Timing(ReactApplicationContext reactContext,
DevSupportManager devSupportManager) |
Modifier and Type | Method and Description |
---|---|
void |
createTimer(ExecutorToken executorToken,
int callbackID,
int duration,
double jsSchedulingTime,
boolean repeat) |
void |
deleteTimer(ExecutorToken executorToken,
int timerId) |
java.lang.String |
getName() |
void |
initialize()
This is called at the end of
CatalystApplicationFragment#createCatalystInstance()
after the CatalystInstance has been created, in order to initialize NativeModules that require
the CatalystInstance or JS modules. |
void |
onCatalystInstanceDestroy()
Called before {CatalystInstance#onHostDestroy}
|
void |
onExecutorDestroyed(ExecutorToken executorToken) |
void |
onHostDestroy()
Called when host activity receives destroy event (e.g.
|
void |
onHostPause()
Called when host activity receives pause event (e.g.
|
void |
onHostResume()
Called when host activity receives resume event (e.g.
|
void |
setSendIdleEvents(ExecutorToken executorToken,
boolean sendIdleEvents) |
boolean |
supportsWebWorkers()
In order to support web workers, a module must be aware that it can be invoked from multiple
different JS VMs.
|
getCurrentActivity, getReactApplicationContext
canOverrideExistingModule, getConstants, getMethods, getSyncHooks, onReactBridgeInitialized, writeConstantsField
public Timing(ReactApplicationContext reactContext, DevSupportManager devSupportManager)
public void initialize()
NativeModule
CatalystApplicationFragment#createCatalystInstance()
after the CatalystInstance has been created, in order to initialize NativeModules that require
the CatalystInstance or JS modules.initialize
in interface NativeModule
initialize
in class BaseJavaModule
public void onHostPause()
LifecycleEventListener
Activity#onPause
. Always called
for the most current activity.onHostPause
in interface LifecycleEventListener
public void onHostDestroy()
LifecycleEventListener
Activity#onDestroy
. Only called
for the last React activity to be destroyed.onHostDestroy
in interface LifecycleEventListener
public void onHostResume()
LifecycleEventListener
Activity#onResume
. Always called
for the most current activity.onHostResume
in interface LifecycleEventListener
public void onCatalystInstanceDestroy()
NativeModule
onCatalystInstanceDestroy
in interface NativeModule
onCatalystInstanceDestroy
in class BaseJavaModule
public java.lang.String getName()
getName
in interface NativeModule
require()
this module
from javascript.public boolean supportsWebWorkers()
NativeModule
ExecutorToken
as the first parameter before any arguments
from JS. This ExecutorToken internally maps to a specific JS VM and can be used by the
framework to route calls appropriately. In order to make JS module calls correctly, start using
the version of ReactContext.getJSModule(ExecutorToken, Class)
that takes an
ExecutorToken. It will ensure that any calls you dispatch to the returned object will go to
the right VM. For Callbacks, you don't have to do anything special -- the framework
automatically tags them with the correct ExecutorToken when the are created.
Note: even though calls can come from multiple JS VMs on multiple threads, calls to this module
will still only occur on a single thread.supportsWebWorkers
in interface NativeModule
supportsWebWorkers
in class BaseJavaModule
public void onExecutorDestroyed(ExecutorToken executorToken)
onExecutorDestroyed
in interface OnExecutorUnregisteredListener
public void createTimer(ExecutorToken executorToken, int callbackID, int duration, double jsSchedulingTime, boolean repeat)
public void deleteTimer(ExecutorToken executorToken, int timerId)
public void setSendIdleEvents(ExecutorToken executorToken, boolean sendIdleEvents)