History log of /expo/packages/expo-modules-core/android/src/main/cpp/ExpoModulesHostObject.h (Results 1 – 3 of 3)
Revision Date Author Comments
# b627df43 21-Mar-2023 Łukasz Kosmaty <[email protected]>

[core][Android] Make module initialization lazy (#21774)

# Why

This approach guarantees that module functions and properties are only initialized upon user request. When the module is required by

[core][Android] Make module initialization lazy (#21774)

# Why

This approach guarantees that module functions and properties are only initialized upon user request. When the module is required by JavaScript, it does not automatically mean that all of its members will be added at that moment. Instead, they will be added at a later time, as needed.

# How

Added `LazyObject` abstraction as it was done on iOS.
Used an arbitrary js object instead of HostObject to define modules - it'll be handy in the future when I'll be adding shared classes.

# Test Plan

- unit tests ✅
- bare-expo ✅

show more ...


# 33ae33ea 11-Oct-2022 Łukasz Kosmaty <[email protected]>

[modules][Android] Fix `JSCRuntime destroyed with a dangling API object` (#19487)

# Why

Closes https://github.com/expo/expo/issues/19221.

# How

In the current memory modal, all of our JSI r

[modules][Android] Fix `JSCRuntime destroyed with a dangling API object` (#19487)

# Why

Closes https://github.com/expo/expo/issues/19221.

# How

In the current memory modal, all of our JSI references are cleared when GC runs through java unused objects. It turns out that is not the best flow, because JSC has an assertion that checks if all references were cleared. So we have to remove dangling references before the JSC runtime fully deallocates.

# Test Plan

- bare-expo with JSC and Heremes ✅

show more ...


# 64f5c95f 17-May-2022 Łukasz Kosmaty <[email protected]>

[module-core][Kotlin] Add basic support for sync function (#16977)

# Why

Closes ENG-4608.
Adds basic support for sync function.

# How

- Created ExpoModulesHostObject that installs into the

[module-core][Kotlin] Add basic support for sync function (#16977)

# Why

Closes ENG-4608.
Adds basic support for sync function.

# How

- Created ExpoModulesHostObject that installs into the runtime as `global.ExpoModules`. A host object is an abstract object where we can define our property getter, allowing us to create JS object for each module lazily.
- Added `isAsync` property to sweet functions and `runSynchronously()` modifier - that will be changed in the future.
- Created `JavaScriptModuleObject` that represents a module in the JS world. It has a map of methods with a cached body.
- All the communication goes via two kotlin methods - `getJavaScriptModuleObject` (which returns a hybrid representation of the module) and `callMethodSync` (which is calling correct implementation). Right now, I'm not using lambdas to pass Kotlin functions into CPP, because I don't see any reason why should I.

# Test Plan

- tested with bare-expo ✅

show more ...