@lynx-js/web-worker-runtime 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @lynx-js/web-worker-runtime
2
2
 
3
+ ## 0.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: onNapiModulesCall function add new param: `dispatchNapiModules`, napiModulesMap val add new param: `handleDispatch`. ([#414](https://github.com/lynx-family/lynx-stack/pull/414))
8
+
9
+ Now you can use them to actively communicate to napiModules (background thread) in onNapiModulesCall (ui thread).
10
+
11
+ - Updated dependencies [[`1af3b60`](https://github.com/lynx-family/lynx-stack/commit/1af3b6052ab27f98bf0e4d1b0ec9f7d9e88e0afc)]:
12
+ - @lynx-js/web-constants@0.10.1
13
+ - @lynx-js/web-mainthread-apis@0.10.1
14
+ - @lynx-js/web-worker-rpc@0.10.1
15
+
3
16
  ## 0.10.0
4
17
 
5
18
  ### Minor Changes
@@ -1,11 +1,13 @@
1
1
  // Copyright 2023 The Lynx Authors. All rights reserved.
2
2
  // Licensed under the Apache License Version 2.0 that can be found in the
3
3
  // LICENSE file in the root directory of this source tree.
4
- import { napiModulesCallEndpoint, } from '@lynx-js/web-constants';
4
+ import { dispatchNapiModuleEndpoint, napiModulesCallEndpoint, } from '@lynx-js/web-constants';
5
5
  export const createNapiLoader = async (rpc, napiModulesMap) => {
6
6
  const napiModulesCall = rpc.createCall(napiModulesCallEndpoint);
7
7
  const napiModules = {};
8
- await Promise.all(Object.entries(napiModulesMap).map(([moduleName, moduleStr]) => import(/* webpackIgnore: true */ moduleStr).then(module => napiModules[moduleName] = module?.default?.(napiModules, (name, data) => napiModulesCall(name, data, moduleName)))));
8
+ await Promise.all(Object.entries(napiModulesMap).map(([moduleName, moduleStr]) => import(/* webpackIgnore: true */ moduleStr).then(module => napiModules[moduleName] = module?.default?.(napiModules, (name, data) => napiModulesCall(name, data, moduleName), (func) => {
9
+ rpc.registerHandler(dispatchNapiModuleEndpoint, (data) => func(data));
10
+ }))));
9
11
  return {
10
12
  load(moduleName) {
11
13
  return napiModules[moduleName];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-worker-runtime",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -23,9 +23,9 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@lynx-js/offscreen-document": "0.0.0",
26
- "@lynx-js/web-constants": "0.10.0",
27
- "@lynx-js/web-mainthread-apis": "0.10.0",
28
- "@lynx-js/web-worker-rpc": "0.10.0"
26
+ "@lynx-js/web-constants": "0.10.1",
27
+ "@lynx-js/web-mainthread-apis": "0.10.1",
28
+ "@lynx-js/web-worker-rpc": "0.10.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@lynx-js/lynx-core": "0.1.0"