@hylid/call 3.0.0-alpha.11 → 3.0.0-alpha.12

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/lib/mpWebCall.js +17 -2
  2. package/package.json +3 -3
package/lib/mpWebCall.js CHANGED
@@ -1,16 +1,31 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
1
11
  var loadAppxBridge = function loadAppxBridge(cb) {
12
+ var _a;
2
13
  try {
3
- // @ts-ignore
4
- if (window.my) {
14
+ // umd 包用的 IFF 模式,会立即向 window.my 上注入 jsapi,所以不能试用 window.my 判断是否已经加载了 appx 脚本
15
+ if ((_a = window.my) === null || _a === void 0 ? void 0 : _a.__hy_mounted__) {
5
16
  cb && cb("ready" /* BridgeReady.READY */);
6
17
  return;
7
18
  }
19
+ var originMy_1 = window.my || {};
8
20
  var script_1 = document.createElement('script');
9
21
  script_1.src = 'https://appx/web-view.min.js';
10
22
  script_1.onload = function onload() {
11
23
  var readyState = script_1['readyState'];
12
24
  if (typeof readyState === 'undefined' || /^(loaded|complete)$/.test(readyState)) {
13
25
  script_1.onload = null;
26
+ window.my = __assign(__assign(__assign({}, window.my), originMy_1), {
27
+ __hy_mounted__: true
28
+ });
14
29
  cb && cb("loaded" /* BridgeReady.LOADED */);
15
30
  }
16
31
  };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@hylid/call",
3
- "version": "3.0.0-alpha.11",
3
+ "version": "3.0.0-alpha.12",
4
4
  "main": "lib/index.js",
5
5
  "files": [
6
6
  "lib"
7
7
  ],
8
8
  "dependencies": {
9
- "@hylid/env": "^3.0.0-alpha.11",
10
- "@hylid/types": "^3.0.0-alpha.11"
9
+ "@hylid/env": "^3.0.0-alpha.12",
10
+ "@hylid/types": "^3.0.0-alpha.12"
11
11
  },
12
12
  "publishConfig": {
13
13
  "access": "public"