@taole/dev-helper 0.0.27 → 0.0.29

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.
@@ -85,34 +85,11 @@
85
85
  }
86
86
  }
87
87
  _handleAlinkClick() {
88
- // var nowTs = Date.now();
89
- // console.log("this._alink is clicked", Date.now() - nowTs);
90
- // 端外使用scheme打开app,3秒内如果页面依然可见,说明没有跳转到app里边,则跳转到fallback链接
91
- if (this._alink_click_timer) {
92
- clearTimeout(this._alink_click_timer);
93
- }
94
- let isPageHide = false;
95
- this._pagehideCallback = this._pagehideCallback || function () {
96
- // console.log("visibilitychange called", document.hidden, Date.now() - nowTs);
97
- if (document.hidden) {
98
- isPageHide = true;
99
- }
100
- };
101
- window.removeEventListener("visibilitychange", this._pagehideCallback);
102
- window.addEventListener("visibilitychange", this._pagehideCallback);
103
- this._alink_click_timer = setTimeout(() => {
104
- window.removeEventListener("visibilitychange", this._pagehideCallback);
105
- setTimeout(() => {
106
- // console.log("3s到了22", isPageHide, Date.now() - nowTs);
107
- // console.log("document.hasFocus()", document.hasFocus());
108
- if (isPageHide || document.hasFocus()) return;
109
- this._alink_click_timer = null;
110
- // window.location.href = this._alink_fallback; // 直接重定向的话ios上没法去到appstore
111
- var tmplnk = document.createElement("a");
112
- tmplnk.href = this._alink_fallback;
113
- tmplnk.click();
114
- }, 30);
115
- }, 3000);
88
+ setTimeout(() => {
89
+ var tmplnk = document.createElement("a");
90
+ tmplnk.href = this._alink_fallback;
91
+ tmplnk.click();
92
+ }, 1000);
116
93
  }
117
94
  disconnectedCallback() {
118
95
  if (this._openAppTag) {
@@ -79,34 +79,11 @@ function defineTag() {
79
79
  }
80
80
  }
81
81
  _handleAlinkClick() {
82
- // var nowTs = Date.now();
83
- // console.log("this._alink is clicked", Date.now() - nowTs);
84
- // 端外使用scheme打开app,3秒内如果页面依然可见,说明没有跳转到app里边,则跳转到fallback链接
85
- if (this._alink_click_timer) {
86
- clearTimeout(this._alink_click_timer);
87
- }
88
- let isPageHide = false;
89
- this._pagehideCallback = this._pagehideCallback || function () {
90
- // console.log("visibilitychange called", document.hidden, Date.now() - nowTs);
91
- if (document.hidden) {
92
- isPageHide = true;
93
- }
94
- }
95
- window.removeEventListener("visibilitychange", this._pagehideCallback);
96
- window.addEventListener("visibilitychange", this._pagehideCallback);
97
- this._alink_click_timer = setTimeout(() => {
98
- window.removeEventListener("visibilitychange", this._pagehideCallback);
99
- setTimeout(() => {
100
- // console.log("3s到了22", isPageHide, Date.now() - nowTs);
101
- // console.log("document.hasFocus()", document.hasFocus());
102
- if (isPageHide || document.hasFocus()) return;
103
- this._alink_click_timer = null;
104
- // window.location.href = this._alink_fallback; // 直接重定向的话ios上没法去到appstore
105
- var tmplnk = document.createElement("a");
106
- tmplnk.href = this._alink_fallback;
107
- tmplnk.click();
108
- }, 30);
109
- }, 3000);
82
+ setTimeout(() => {
83
+ var tmplnk = document.createElement("a");
84
+ tmplnk.href = this._alink_fallback;
85
+ tmplnk.click();
86
+ }, 1000);
110
87
  }
111
88
  disconnectedCallback() {
112
89
  if (this._openAppTag) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/dev-helper",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "npx -y rimraf dist && rollup -c",