@onekeyfe/onekey-cross-webview 2.2.34 → 2.2.36

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.
@@ -1,4 +1,4 @@
1
- import { JsBridgeBase, } from '@onekeyfe/cross-inpage-provider-core';
1
+ import { JsBridgeBase, appDebugLogger, } from '@onekeyfe/cross-inpage-provider-core';
2
2
  class JsBridgeDesktopHost extends JsBridgeBase {
3
3
  constructor(config) {
4
4
  super(config);
@@ -6,7 +6,7 @@ class JsBridgeDesktopHost extends JsBridgeBase {
6
6
  this.webviewRef = config.webviewRef;
7
7
  }
8
8
  sendPayload(payload) {
9
- var _a;
9
+ var _a, _b;
10
10
  if (this.webviewRef && this.webviewRef.current) {
11
11
  const payloadStr = payload;
12
12
  if (this.webviewRef.current) {
@@ -15,7 +15,14 @@ class JsBridgeDesktopHost extends JsBridgeBase {
15
15
  // appDebugLogger.webview('executeJavaScript', inpageReceiveCode, payload);
16
16
  // this.webviewRef.current?.executeJavaScript?.(inpageReceiveCode);
17
17
  // *** use ipcRenderer.on instead
18
- (_a = this.webviewRef.current) === null || _a === void 0 ? void 0 : _a.send('JsBridgeDesktopHostToInjected', payloadStr);
18
+ try {
19
+ (_b = (_a = this.webviewRef.current) === null || _a === void 0 ? void 0 : _a.send('JsBridgeDesktopHostToInjected', payloadStr)) === null || _b === void 0 ? void 0 : _b.catch((error) => {
20
+ appDebugLogger.webview('send', error);
21
+ });
22
+ }
23
+ catch (error) {
24
+ appDebugLogger.webview('send', error);
25
+ }
19
26
  }
20
27
  else {
21
28
  throw new Error('JsBridgeDesktopHost executeJavaScript failed: webview ref not ready yet.');
@@ -9,7 +9,7 @@ class JsBridgeDesktopHost extends cross_inpage_provider_core_1.JsBridgeBase {
9
9
  this.webviewRef = config.webviewRef;
10
10
  }
11
11
  sendPayload(payload) {
12
- var _a;
12
+ var _a, _b;
13
13
  if (this.webviewRef && this.webviewRef.current) {
14
14
  const payloadStr = payload;
15
15
  if (this.webviewRef.current) {
@@ -18,7 +18,14 @@ class JsBridgeDesktopHost extends cross_inpage_provider_core_1.JsBridgeBase {
18
18
  // appDebugLogger.webview('executeJavaScript', inpageReceiveCode, payload);
19
19
  // this.webviewRef.current?.executeJavaScript?.(inpageReceiveCode);
20
20
  // *** use ipcRenderer.on instead
21
- (_a = this.webviewRef.current) === null || _a === void 0 ? void 0 : _a.send('JsBridgeDesktopHostToInjected', payloadStr);
21
+ try {
22
+ (_b = (_a = this.webviewRef.current) === null || _a === void 0 ? void 0 : _a.send('JsBridgeDesktopHostToInjected', payloadStr)) === null || _b === void 0 ? void 0 : _b.catch((error) => {
23
+ cross_inpage_provider_core_1.appDebugLogger.webview('send', error);
24
+ });
25
+ }
26
+ catch (error) {
27
+ cross_inpage_provider_core_1.appDebugLogger.webview('send', error);
28
+ }
22
29
  }
23
30
  else {
24
31
  throw new Error('JsBridgeDesktopHost executeJavaScript failed: webview ref not ready yet.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/onekey-cross-webview",
3
- "version": "2.2.34",
3
+ "version": "2.2.36",
4
4
  "keywords": [
5
5
  "cross-inpage-provider"
6
6
  ],
@@ -35,8 +35,8 @@
35
35
  "react-native-webview": "^11.17.2"
36
36
  },
37
37
  "dependencies": {
38
- "@onekeyfe/cross-inpage-provider-core": "2.2.34",
39
- "@onekeyfe/cross-inpage-provider-types": "2.2.34"
38
+ "@onekeyfe/cross-inpage-provider-core": "2.2.36",
39
+ "@onekeyfe/cross-inpage-provider-types": "2.2.36"
40
40
  },
41
- "gitHead": "d99d29ed6b09324bff7ccc96ebcf9e282b2be109"
41
+ "gitHead": "ae1a47e242ecd42a023b296a2cfc3558a81087a1"
42
42
  }