Skip to content

Worklets - 0.12.0

Choose a tag to compare

@tjzel tjzel released this 11 Aug 15:15
· 2 commits to worklets-0.12-stable since this release

Key changes

WeakRef on Worklet Runtimes

Worklet Runtimes now support WeakRef. This required enabling Hermes' own microtask queue when the runtime is created, and draining it from C++.

  • feat(Worklets): WeakRef on Worklet Runtimes by @tjzel in #10085
  • refactor(worklets): consolidate scheduling API for microtask policies by @tjzel in #10100
  • refactor(Worklets): move microtasks call to C++ by @tjzel in #10175

Bundle Mode script loading on par with React Native

Bundle Mode used to load the script through in-memory copies. On iOS the whole bundle stayed resident in a std::string for the app's lifetime, and on Android a dev-server bundle passed through a Java String and two more copies over JNI. Local bundles are now mmapped and Android dev-server downloads stream to a cache file, the same way React Native's own loaders work. Dev-server fetches now also check the HTTP status and surface the error message Metro returns. In development on Android, initialization reuses the bundle React Native has already downloaded.

  • feat(Worklets): bring Bundle Mode script loading on par with React Native by @tjzel in #10087
  • feat(Worklets): reuse React Native's downloaded dev bundle on Android by @tjzel in #10088

enableLocking option in createWorkletRuntime

createWorkletRuntime accepts a new enableLocking option, which creates a Worklet Runtime without mutex guards. It is meant for advanced use cases, where you can guarantee thread-safety of the runtime.

  • feat(Worklets): add enableLocking option to createWorkletRuntime by @tjzel in #9940

Other changes

  • feat(Worklets): Descriptive warning in createSerializable by @tshmieldev in #9993
  • fix: Adjust createSerializableInaccessibleObject to the Release createSerializable behavior by @tjzel in #10013
  • fix(Worklets): RetainingSerializable race condition by @tjzel in #10113
  • fix(Worklets): web scheduleOnUI implementation on errors by @tjzel in #10167
  • fix(Worklets): Jest mocks missing APIs by @tjzel in #10183
  • fix(Worklets): UI loop not pausing when the app is backgrounded by @tjzel in #10196
  • fix(Worklets): missing autorelease drain on detached worklet threads by @tjzel in #10192
  • refactor(worklets): remove deprecated WorkletRuntime sync API by @tjzel in #10091
  • docs(worklets): document WorkletRuntime schedule and runSync API by @tjzel in #10097
  • chore(Worklets): remove leftover RCTBundleConsumer imports by @tjzel in #10086
  • chore(Worklets): amend bun patching instructions by @tjzel in #9992

Full Changelog: worklets-0.11.3...worklets-0.12.0