@microbt/environment 1.2.2 → 1.2.4

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.
Files changed (2) hide show
  1. package/dist/esm/hybrid.js +12 -3
  2. package/package.json +1 -1
@@ -42,15 +42,24 @@ function bridgeCall(method, params, callback) {
42
42
  function bridgeBootstrap() {
43
43
  function bootstrap(callback) {
44
44
  var _a, _b, _c;
45
+ if (!callback || typeof callback !== "function") {
46
+ Logger.error("bootstrap: Invalid callback provided");
47
+ return;
48
+ }
45
49
  if (window.SuperAcme && typeof window.SuperAcme.call === "function") {
50
+ Logger.debug("bootstrap: SuperAcme bridge is ready");
46
51
  return callback();
47
52
  }
48
- if (window.WKWVJBCallbacks) {
53
+ if (Array.isArray(window.WKWVJBCallbacks)) {
54
+ Logger.debug("bootstrap: Adding callback to existing WKWVJBCallbacks queue");
49
55
  return window.WKWVJBCallbacks.push(callback);
50
56
  }
57
+ Logger.debug("bootstrap: Initializing WKWVJBCallbacks");
51
58
  window.WKWVJBCallbacks = [callback];
52
- if (window.webkit) {
53
- (_c = (_b = (_a = window.webkit.messageHandlers) == null ? void 0 : _a.iOS_Native_InjectJavascript) == null ? void 0 : _b.postMessage) == null ? void 0 : _c.call(_b, null);
59
+ if (((_c = (_b = (_a = window.webkit) == null ? void 0 : _a.messageHandlers) == null ? void 0 : _b.iOS_Native_InjectJavascript) == null ? void 0 : _c.postMessage) && typeof window.webkit.messageHandlers.iOS_Native_InjectJavascript.postMessage === "function") {
60
+ window.webkit.messageHandlers.iOS_Native_InjectJavascript.postMessage(null);
61
+ } else {
62
+ Logger.warn("iOS bridge postMessage method not available or not a function");
54
63
  }
55
64
  }
56
65
  if (iOSWebview) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microbt/environment",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "microbt app library for environment",
5
5
  "keywords": [],
6
6
  "license": "MIT",