public class CxxModuleWrapper extends java.lang.Object implements NativeModule
NativeModule.NativeMethod, NativeModule.SyncNativeHook
Modifier | Constructor and Description |
---|---|
protected |
CxxModuleWrapper(HybridData hd) |
|
CxxModuleWrapper(java.lang.String library,
java.lang.String factory) |
Modifier and Type | Method and Description |
---|---|
boolean |
canOverrideExistingModule()
Return true if you intend to override some other native module that was registered e.g.
|
java.lang.String |
getConstantsJson() |
java.util.Map<java.lang.String,NativeModule.NativeMethod> |
getMethods() |
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 |
onReactBridgeInitialized(ReactBridge bridge)
Called on the JS thread after a ReactBridge has been created.
|
boolean |
supportsWebWorkers()
In order to support web workers, a module must be aware that it can be invoked from multiple
different JS VMs.
|
void |
writeConstantsField(JsonWriter writer,
java.lang.String fieldName)
Append a field which represents the constants this module exports
to JS.
|
public CxxModuleWrapper(java.lang.String library, java.lang.String factory)
protected CxxModuleWrapper(HybridData hd)
public java.lang.String getName()
getName
in interface NativeModule
require()
this module
from javascript.public java.util.Map<java.lang.String,NativeModule.NativeMethod> getMethods()
getMethods
in interface NativeModule
public void writeConstantsField(JsonWriter writer, java.lang.String fieldName) throws java.io.IOException
NativeModule
writeConstantsField
in interface NativeModule
java.io.IOException
public java.lang.String getConstantsJson()
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
public boolean canOverrideExistingModule()
NativeModule
canOverrideExistingModule
in interface NativeModule
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
public void onReactBridgeInitialized(ReactBridge bridge)
NativeModule
onReactBridgeInitialized
in interface NativeModule
bridge
- the ReactBridge instance that has just been createdpublic void onCatalystInstanceDestroy()
NativeModule
onCatalystInstanceDestroy
in interface NativeModule