History log of /expo/packages/expo-modules-core/android/src/main/cpp/JavaScriptValue.h (Results 1 – 7 of 7)
Revision Date Author Comments
# 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 ...


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


# 4b11e9d6 23-Jun-2022 Łukasz Kosmaty <[email protected]>

[sweet API][Kotlin] Add `isArray` and `getArray` functions to `JavaScriptValue` (#17940)

# Why

Adds functions to obtain arrays of `JavaScriptValue` from the `JavaScriptValue`.

# How

It was

[sweet API][Kotlin] Add `isArray` and `getArray` functions to `JavaScriptValue` (#17940)

# Why

Adds functions to obtain arrays of `JavaScriptValue` from the `JavaScriptValue`.

# How

It was pretty straightforward. Iterate through js array and box all values in the `JavaScriptValue` object.

# Test Plan

- unit test will be added in a different PR ✅

show more ...


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