History log of /expo/packages/expo-modules-core/android/src/main/cpp/JavaScriptObject.h (Results 1 – 12 of 12)
Revision Date Author Comments
# e1f25825 08-Aug-2023 Łukasz Kosmaty <[email protected]>

[core] Move `defineProperty` and `ObjectDeallocator` to common code (#23860)

# Why

Moves `defineProperty` and `ObjectDeallocator` to common code.

# Test Plan

- bare-expo ✅
- native-tester

[core] Move `defineProperty` and `ObjectDeallocator` to common code (#23860)

# Why

Moves `defineProperty` and `ObjectDeallocator` to common code.

# Test Plan

- bare-expo ✅
- native-tester ✅

show more ...


# 29e8b6f8 25-May-2023 Łukasz Kosmaty <[email protected]>

[core][Android] Bind `JNIDeallocator` to the context (#22610)

# Why

Binds the `JNIDeallocator` to the current context.

# How

I've discovered that making `JNIDeallocator` static wasn't a go

[core][Android] Bind `JNIDeallocator` to the context (#22610)

# Why

Binds the `JNIDeallocator` to the current context.

# How

I've discovered that making `JNIDeallocator` static wasn't a good decision. This approach failed to function properly when we migrated to our API in the dev-launcher context. Whenever the user switches between the app and launcher, the app will crash since the dev-launcher remains in memory, but the app context's destruction causes all registered objects inside the `JNIDeallocator` to deallocate. Consequently, we're removing js objects associated with the dev-launcher context, even if it's still valid.

# Test Plan

- bare-expo with and without dev-client ✅
- unit tests ✅

show more ...


# 879827bb 06-Apr-2023 Łukasz Kosmaty <[email protected]>

[core][Android] Add functions converter (#21976)

# Why

Adds functions converter.

# How

- Adds a frontend and backend converter for js function type
- Adds ability to call those functions

[core][Android] Add functions converter (#21976)

# Why

Adds functions converter.

# How

- Adds a frontend and backend converter for js function type
- Adds ability to call those functions via Kotlin code

# Test Plan

- unit tests ✅

show more ...


# 7cfebc52 31-Mar-2023 Łukasz Kosmaty <[email protected]>

[core][Android] Improve memory consumption (#21906)

# Why

Improves memory consumption.
Adds a native destructor to the shared object.

# How

- Adds a native destructor to the shared objec

[core][Android] Improve memory consumption (#21906)

# Why

Improves memory consumption.
Adds a native destructor to the shared object.

# How

- Adds a native destructor to the shared object instance.
- Patched memory leak caused by unreleased global reference inside of the MethodMetadata class.
- Adds a global registry to force deallocation of JNI objects that holds references to jsi values when the app is reloaded.
- Adds a memory inspector to check which of JNI objects are still present in the memory.

# Test Plan

- unit tests ✅
- bare-expo with JSC and Hermes ✅

show more ...


# cf4fff55 22-Mar-2023 Łukasz Kosmaty <[email protected]>

[core][Android] Add class component (#21799)

# Why

Adds class component. This's a follow-up to https://github.com/expo/expo/pull/17412.

# How

Added a class component similar to the one on i

[core][Android] Add class component (#21799)

# Why

Adds class component. This's a follow-up to https://github.com/expo/expo/pull/17412.

# How

Added a class component similar to the one on iOS. It's not finished yet - this's just the first part.

# To do

- Rename `JavaScriptModuleObject` to something more descriptive. That class is no longer used just to declare modules
- Call constructor defined in the class component
- Pass `this` to sync/async functions.
- Add shared objects

# Test Plan

- unit tests ✅

show more ...


# 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 ...


# dedc0ffd 29-Sep-2022 Łukasz Kosmaty <[email protected]>

[modules][Android] Install modules host object as `global.expo.modules` instead of `global.ExpoModules` (#19281)

# Why

A follow-up to https://github.com/expo/expo/pull/19273.

# How

- Added

[modules][Android] Install modules host object as `global.expo.modules` instead of `global.ExpoModules` (#19281)

# Why

A follow-up to https://github.com/expo/expo/pull/19273.

# How

- Added `global.expo` object to the runtime.
- Installed the Expo Modules host object as `global.expo.modules`.
- Deprecated `global.ExpoModules`, which will still exist in SDK47 for one-cycle backward compatibility. It can be removed in SDK48.
- Migrated references to `global.ExpoModules` in native unit tests

# Test Plan

- unit test ✅
- NCL ✅

show more ...


# 05c5e37d 29-Jul-2022 Łukasz Kosmaty <[email protected]>

[sweet API][Kotlin] Implement sweet typed arrays (#18379)

# Why

A follow-up to the https://github.com/expo/expo/pull/17667.

# How

- Reused some C++ utils to deal with typed arrays
- Made c

[sweet API][Kotlin] Implement sweet typed arrays (#18379)

# Why

A follow-up to the https://github.com/expo/expo/pull/17667.

# How

- Reused some C++ utils to deal with typed arrays
- Made classes for typed arrays on both sides: native and JS
- Added new converters to obtain typed arrays as function arguments
- Added tests

# Test Plan

- unit tests ✅

show more ...


# 256b5942 27-Jul-2022 Łukasz Kosmaty <[email protected]>

[sweet API][Kotlin] Simplify usage of `JavaScriptRuntime` (#18382)

# Why

In many places, we have a similar code that accesses the `jsi::Runtime` from `weak_ptr`. It makes the code hard to read. S

[sweet API][Kotlin] Simplify usage of `JavaScriptRuntime` (#18382)

# Why

In many places, we have a similar code that accesses the `jsi::Runtime` from `weak_ptr`. It makes the code hard to read. So I decided to decorate the `std::weak_ptr<JavaScriptRuntime>` with additional access functions.

# How

Added a `WeakRuntimeHolder` with two additional methods to access `jsi::Runtime`

# Test Plan

- unit tests ✅

show more ...


# 64f4fd05 31-May-2022 Łukasz Kosmaty <[email protected]>

[sweet API][Kotlin] Add `JavaScriptObject.defineProperty` (#17685)

# Why

Adds `JavaScriptObject.defineProperty`.
Similar to the #17684.

# Test Plan

- unit tests ✅


# 14c0f05d 31-May-2022 Łukasz Kosmaty <[email protected]>

[sweet API][Kotlin] Add `JavaScriptObject.setProperty` (#17684)

# Why

Adds `setProperty` to the `JavaScriptObject`.

# How

- Adds a base interface to indicate if the derived class wrap a jsi

[sweet API][Kotlin] Add `JavaScriptObject.setProperty` (#17684)

# Why

Adds `setProperty` to the `JavaScriptObject`.

# How

- Adds a base interface to indicate if the derived class wrap a jsi::Value or jsi::Object.
- Adds a conversion between JNI and jsi objects based on the type traits.
- Hides raw JNI API in the `JavaScriptObject` using methods overload.
- Adds unit tests

# Test Plan

- unit tests ✅

show more ...


# a416e6db 24-May-2022 Łukasz Kosmaty <[email protected]>

[sweet][Kotlin] Add `evaluateScript` function (#17586)

# Why

Adds a `evaluateScript` function.
Also, adds wrappers for `jsi::Value` and `jsi::Object`.

# How

Exposes a `evaluateScript` fun

[sweet][Kotlin] Add `evaluateScript` function (#17586)

# Why

Adds a `evaluateScript` function.
Also, adds wrappers for `jsi::Value` and `jsi::Object`.

# How

Exposes a `evaluateScript` function to Kotlin (it's pretty handy in the tests environment). I've also created a wrapper for jsi types. For now, it's read-only, but that will be expanded in the future.

# Test Plan

- unit tests ✅

show more ...