@taole/dev-helper 0.0.15 → 0.0.16

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.
@@ -4,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.OpenDiandian = factory());
5
5
  })(this, (function () { 'use strict';
6
6
 
7
- const version = '0.0.1';
7
+ const name = 'open-diandian';
8
8
  // 测试使用open-diandain-app标签
9
9
  function defineTag() {
10
10
  customElements.define(
@@ -53,6 +53,7 @@
53
53
  this._template.content.appendChild(this._openAppTag);
54
54
  this.attachShadow({ mode: 'open' });
55
55
  this.shadowRoot.appendChild(this._template.content);
56
+ console.log('open-diandian: wx-open-launch-app appended');
56
57
  } else {
57
58
  this._updateTagAttr();
58
59
  }
@@ -67,31 +68,38 @@
67
68
  this.attachShadow({ mode: 'open' });
68
69
  this.shadowRoot.appendChild(this._template.content);
69
70
  this._alink.addEventListener('click', this._handleAlinkClick.bind(this));
71
+ console.log('open-diandian: open link appended');
70
72
  }
71
73
  this._updateTagAttr();
72
74
  }
73
75
  }
74
76
  _handleAlinkClick() {
75
- console.log("this._alink is clicked");
77
+ // var nowTs = Date.now();
78
+ // console.log("this._alink is clicked", Date.now() - nowTs);
76
79
  // 端外使用scheme打开app,3秒内如果页面依然可见,说明没有跳转到app里边,则跳转到fallback链接
77
80
  if (this._alink_click_timer) {
78
81
  clearTimeout(this._alink_click_timer);
79
82
  }
80
83
  let isPageHide = false;
81
84
  this._pagehideCallback = this._pagehideCallback || function () {
82
- if (document.hidden) isPageHide = true;
85
+ // console.log("visibilitychange called", document.hidden, Date.now() - nowTs);
86
+ if (document.hidden) {
87
+ isPageHide = true;
88
+ }
83
89
  };
84
90
  window.removeEventListener("visibilitychange", this._pagehideCallback);
85
91
  window.addEventListener("visibilitychange", this._pagehideCallback);
86
92
  this._alink_click_timer = setTimeout(() => {
87
- console.log("3s到了", isPageHide);
88
93
  window.removeEventListener("visibilitychange", this._pagehideCallback);
89
- if (isPageHide) return;
90
- this._alink_click_timer = null;
91
- // window.location.href = this._alink_fallback; // 直接重定向的话ios上没法去到appstore
92
- var tmplnk = document.createElement("a");
93
- tmplnk.href = this._alink_fallback;
94
- tmplnk.click();
94
+ setTimeout(() => {
95
+ // console.log("3s到了22", isPageHide, Date.now() - nowTs);
96
+ if (isPageHide) return;
97
+ this._alink_click_timer = null;
98
+ // window.location.href = this._alink_fallback; // 直接重定向的话ios上没法去到appstore
99
+ var tmplnk = document.createElement("a");
100
+ tmplnk.href = this._alink_fallback;
101
+ tmplnk.click();
102
+ }, 30);
95
103
  }, 3000);
96
104
  }
97
105
  disconnectedCallback() {
@@ -142,7 +150,7 @@
142
150
 
143
151
  // TODO: 之后放出setting入口之类的
144
152
  var index = {
145
- version
153
+ name
146
154
  };
147
155
 
148
156
  return index;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/dev-helper",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "npx -y rimraf dist && rollup -c",