@taole/dev-helper 0.0.27 → 0.0.28
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.
- package/dist/open-diandian.umd.js +11 -38
- package/open-diandian/index.js +8 -31
- package/package.json +1 -1
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
(function (
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
1
|
+
(function (factory) {
|
|
3
2
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
-
|
|
5
|
-
})(
|
|
3
|
+
factory();
|
|
4
|
+
})((function () { 'use strict';
|
|
6
5
|
|
|
7
|
-
const name = 'open-diandian';
|
|
8
6
|
// 测试使用open-diandain-app标签
|
|
9
7
|
// TODO: 后期可以考虑优化为根据域名自动选择appid
|
|
10
8
|
function defineTag() {
|
|
@@ -85,34 +83,11 @@
|
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
85
|
_handleAlinkClick() {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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);
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
var tmplnk = document.createElement("a");
|
|
88
|
+
tmplnk.href = this._alink_fallback;
|
|
89
|
+
tmplnk.click();
|
|
90
|
+
}, 1000);
|
|
116
91
|
}
|
|
117
92
|
disconnectedCallback() {
|
|
118
93
|
if (this._openAppTag) {
|
|
@@ -195,10 +170,8 @@
|
|
|
195
170
|
|
|
196
171
|
registerTdiv();
|
|
197
172
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return index;
|
|
173
|
+
// export default {
|
|
174
|
+
// name
|
|
175
|
+
// }
|
|
203
176
|
|
|
204
177
|
}));
|
package/open-diandian/index.js
CHANGED
|
@@ -79,34 +79,11 @@ function defineTag() {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
_handleAlinkClick() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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) {
|
|
@@ -189,6 +166,6 @@ function registerTdiv() {
|
|
|
189
166
|
|
|
190
167
|
registerTdiv();
|
|
191
168
|
|
|
192
|
-
export default {
|
|
193
|
-
|
|
194
|
-
}
|
|
169
|
+
// export default {
|
|
170
|
+
// name
|
|
171
|
+
// }
|