Migrate TurboModuleRegistry to kotlin (#38593)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38593

In this diff I'm migrating TurboModuleRegistry to kotlin

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D47382872

fbshipit-source-id: 9249a269d9253555b9fda8c665da57f62c825821
This commit is contained in:
David Vacca
2023-07-28 06:08:53 -07:00
committed by Facebook GitHub Bot
parent 2736918ece
commit 86bf8d1e89
@@ -5,12 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.turbomodule.core.interfaces;
package com.facebook.react.turbomodule.core.interfaces
import androidx.annotation.Nullable;
import com.facebook.react.bridge.NativeModule;
import java.util.Collection;
import java.util.List;
import com.facebook.react.bridge.NativeModule
import java.util.Collection
/**
* Interface to allow for creating and retrieving NativeModules. Why is this this class prefixed
@@ -18,25 +16,23 @@ import java.util.List;
* already is a NativeModuleRegistry (a part of the legacy architecture). Once that class is
* deleted, we should rename this interface accordingly.
*/
public interface TurboModuleRegistry {
interface TurboModuleRegistry {
/**
* Return the NativeModule instance that has that name `moduleName`. If the `moduleName`
* TurboModule hasn't been instantiated, instantiate it. If no TurboModule is registered under
* `moduleName`, return null.
*/
@Nullable
NativeModule getModule(String moduleName);
fun getModule(moduleName: String): NativeModule?
/** Get all instantiated NativeModules. */
Collection<NativeModule> getModules();
val modules: Collection<NativeModule>
/** Has the NativeModule with name `moduleName` been instantiated? */
boolean hasModule(String moduleName);
fun hasModule(moduleName: String): Boolean
/**
* Return the names of all the NativeModules that are supposed to be eagerly initialized. By
* calling getModule on each name, this allows the application to eagerly initialize its
* NativeModules.
*/
List<String> getEagerInitModuleNames();
val eagerInitModuleNames: List<String>
}