Package 

Interface NativeModule


  • 
    public interface NativeModule
    
                        

    A native module whose API can be provided to JS catalyst instances. NativeModules whose implementation is written in Java should extend BaseJavaModule or . NativeModules whose implementation is written in C++ must not provide any Java code (so they can be reused on other platforms), and instead should register themselves using CxxModuleWrapper.

    • Method Summary

      Modifier and Type Method Description
      abstract String getName()
      abstract void initialize() This is called at the end of createCatalystInstance afterthe CatalystInstance has been created, in order to initialize NativeModules that require theCatalystInstance or JS modules.
      abstract boolean canOverrideExistingModule() Return true if you intend to override some other native module that was registered e.g.
      abstract void onCatalystInstanceDestroy() Allow NativeModule to clean up.
      abstract void invalidate() Allow NativeModule to clean up.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • initialize

         abstract void initialize()

        This is called at the end of createCatalystInstance afterthe CatalystInstance has been created, in order to initialize NativeModules that require theCatalystInstance or JS modules.

      • canOverrideExistingModule

         abstract boolean canOverrideExistingModule()

        Return true if you intend to override some other native module that was registered e.g. as partof a different package (such as the core one). Trying to override without returning true fromthis method is considered an error and will throw an exception during initialization. Bydefault all modules return false.

      • onCatalystInstanceDestroy

         abstract void onCatalystInstanceDestroy()

        Allow NativeModule to clean up. Called before {CatalystInstance#onHostDestroy}

      • invalidate

         abstract void invalidate()

        Allow NativeModule to clean up. Called before {CatalystInstance#onHostDestroy}