@haluo/util 2.0.1 → 2.0.2-0.1
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/README.md +12 -1
- package/dist/index.d.ts +39 -0
- package/dist/index.js +74 -33
- package/dist/modules/cookie/index.d.ts +27 -0
- package/dist/modules/cookie/index.js +55 -54
- package/dist/modules/date/index.d.ts +52 -0
- package/dist/modules/date/index.js +192 -192
- package/dist/modules/dom/index.d.ts +28 -0
- package/dist/modules/dom/index.js +62 -62
- package/dist/modules/filter/index.d.ts +24 -0
- package/dist/modules/filter/index.js +48 -44
- package/dist/modules/format/index.d.ts +15 -0
- package/dist/modules/format/index.js +22 -21
- package/dist/modules/match/index.d.ts +12 -0
- package/dist/modules/match/index.js +31 -31
- package/dist/modules/monitor/index.d.ts +3 -0
- package/dist/modules/monitor/index.js +17 -17
- package/dist/modules/monitor/lib/jsError.d.ts +1 -0
- package/dist/modules/monitor/lib/jsError.js +53 -53
- package/dist/modules/monitor/lib/timing.d.ts +1 -0
- package/dist/modules/monitor/lib/timing.js +69 -69
- package/dist/modules/monitor/lib/xhr.d.ts +1 -0
- package/dist/modules/monitor/lib/xhr.js +48 -48
- package/dist/modules/monitor/utils/onload.d.ts +1 -0
- package/dist/modules/monitor/utils/onload.js +11 -11
- package/dist/modules/monitor/utils/tracker.d.ts +7 -0
- package/dist/modules/monitor/utils/tracker.js +63 -63
- package/dist/modules/number/index.d.ts +47 -0
- package/dist/modules/number/index.js +118 -102
- package/dist/modules/open-app/index.d.ts +84 -0
- package/dist/modules/open-app/index.js +239 -0
- package/dist/modules/sentry/index.d.ts +15 -0
- package/dist/modules/sentry/index.js +81 -81
- package/dist/modules/tools/index.d.ts +166 -0
- package/dist/modules/tools/index.js +393 -393
- package/dist/modules/upload/ALIOSS_EXAMPLE.d.ts +12 -0
- package/dist/modules/upload/ALIOSS_EXAMPLE.js +320 -0
- package/dist/modules/upload/aliOss.d.ts +324 -0
- package/dist/modules/upload/aliOss.js +838 -0
- package/dist/modules/upload/index.d.ts +51 -0
- package/dist/modules/upload/index.js +55 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +3 -11
- package/dist/types/index.js +2 -2
- package/dist/types/modules/cookie/index.d.ts +27 -25
- package/dist/types/modules/date/index.d.ts +52 -1
- package/dist/types/modules/dom/index.d.ts +28 -1
- package/dist/types/modules/filter/index.d.ts +24 -25
- package/dist/types/modules/format/index.d.ts +15 -13
- package/dist/types/modules/match/index.d.ts +12 -1
- package/dist/types/modules/monitor/index.d.ts +3 -3
- package/dist/types/modules/monitor/lib/jsError.d.ts +1 -1
- package/dist/types/modules/monitor/lib/timing.d.ts +1 -1
- package/dist/types/modules/monitor/lib/xhr.d.ts +1 -1
- package/dist/types/modules/monitor/utils/onload.d.ts +1 -1
- package/dist/types/modules/monitor/utils/tracker.d.ts +7 -7
- package/dist/types/modules/number/index.d.ts +41 -39
- package/dist/types/modules/sentry/index.d.ts +15 -15
- package/dist/types/modules/tools/index.d.ts +166 -1
- package/dist/types/types/index.d.ts +3 -3
- package/package.json +18 -14
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function onload(cb) {
|
|
4
|
-
if (document.readyState) {
|
|
5
|
-
cb();
|
|
6
|
-
}
|
|
7
|
-
else {
|
|
8
|
-
window.addEventListener('load', cb);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.default = onload;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function onload(cb) {
|
|
4
|
+
if (document.readyState) {
|
|
5
|
+
cb();
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
window.addEventListener('load', cb);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.default = onload;
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
var uuidv4 = require('uuid').v4;
|
|
15
|
-
// const Parser = require('ua-parser-js');
|
|
16
|
-
var SendTracker = /** @class */ (function () {
|
|
17
|
-
function SendTracker() {
|
|
18
|
-
this.url = '';
|
|
19
|
-
}
|
|
20
|
-
SendTracker.prototype.send = function (data) {
|
|
21
|
-
if (data === void 0) { data = {}; }
|
|
22
|
-
var host = window.location.host;
|
|
23
|
-
if (host.indexOf('localhost') > -1)
|
|
24
|
-
return;
|
|
25
|
-
var reg = /((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/g;
|
|
26
|
-
if (reg.test(host))
|
|
27
|
-
return;
|
|
28
|
-
var log = __assign(__assign({}, getExtraData()), data);
|
|
29
|
-
var formBody = [];
|
|
30
|
-
for (var property in log) {
|
|
31
|
-
var encodedKey = encodeURIComponent(property);
|
|
32
|
-
var encodedValue = encodeURIComponent(log[property]);
|
|
33
|
-
formBody.push(encodedKey + "=" + encodedValue);
|
|
34
|
-
}
|
|
35
|
-
formBody = formBody.join("&");
|
|
36
|
-
fetch('https://apm-collect.58moto.com/app/collect/original/info/report/v2', {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}).then(
|
|
43
|
-
|
|
44
|
-
}).catch(
|
|
45
|
-
|
|
46
|
-
})
|
|
47
|
-
};
|
|
48
|
-
return SendTracker;
|
|
49
|
-
}());
|
|
50
|
-
function getExtraData() {
|
|
51
|
-
return {
|
|
52
|
-
deviceId: uuidv4(),
|
|
53
|
-
platform: 3,
|
|
54
|
-
errorType: 3,
|
|
55
|
-
channel: 'h5',
|
|
56
|
-
bundle: 'com.jdd.motorfans',
|
|
57
|
-
title: '',
|
|
58
|
-
frontStatus: 3,
|
|
59
|
-
occurTimeStamp: Date.now(),
|
|
60
|
-
// userAgent: new Parser().getResult()
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
exports.default = new SendTracker();
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
var uuidv4 = require('uuid').v4;
|
|
15
|
+
// const Parser = require('ua-parser-js');
|
|
16
|
+
var SendTracker = /** @class */ (function () {
|
|
17
|
+
function SendTracker() {
|
|
18
|
+
this.url = '';
|
|
19
|
+
}
|
|
20
|
+
SendTracker.prototype.send = function (data) {
|
|
21
|
+
if (data === void 0) { data = {}; }
|
|
22
|
+
var host = window.location.host;
|
|
23
|
+
if (host.indexOf('localhost') > -1)
|
|
24
|
+
return;
|
|
25
|
+
var reg = /((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/g;
|
|
26
|
+
if (reg.test(host))
|
|
27
|
+
return;
|
|
28
|
+
var log = __assign(__assign({}, getExtraData()), data);
|
|
29
|
+
var formBody = [];
|
|
30
|
+
for (var property in log) {
|
|
31
|
+
var encodedKey = encodeURIComponent(property);
|
|
32
|
+
var encodedValue = encodeURIComponent(log[property]);
|
|
33
|
+
formBody.push(encodedKey + "=" + encodedValue);
|
|
34
|
+
}
|
|
35
|
+
formBody = formBody.join("&");
|
|
36
|
+
// fetch('https://apm-collect.58moto.com/app/collect/original/info/report/v2', {
|
|
37
|
+
// method: 'POST',
|
|
38
|
+
// headers: {
|
|
39
|
+
// "Content-Type":"application/x-www-form-urlencoded"
|
|
40
|
+
// },
|
|
41
|
+
// body: formBody,
|
|
42
|
+
// }).then(res => {
|
|
43
|
+
// // console.log(res)
|
|
44
|
+
// }).catch((e) => {
|
|
45
|
+
// console.log(e)
|
|
46
|
+
// })
|
|
47
|
+
};
|
|
48
|
+
return SendTracker;
|
|
49
|
+
}());
|
|
50
|
+
function getExtraData() {
|
|
51
|
+
return {
|
|
52
|
+
deviceId: uuidv4(),
|
|
53
|
+
platform: 3,
|
|
54
|
+
errorType: 3,
|
|
55
|
+
channel: 'h5',
|
|
56
|
+
bundle: 'com.jdd.motorfans',
|
|
57
|
+
title: '',
|
|
58
|
+
frontStatus: 3,
|
|
59
|
+
occurTimeStamp: Date.now(),
|
|
60
|
+
// userAgent: new Parser().getResult()
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
exports.default = new SendTracker();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare class NumberClass {
|
|
2
|
+
/**
|
|
3
|
+
* 个位数前面补0
|
|
4
|
+
* @param {Number} num 需要格式化的数字
|
|
5
|
+
* @return {String} '01'
|
|
6
|
+
*/
|
|
7
|
+
formatNumber(num: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* 将手机号中间部分替换为星号
|
|
10
|
+
* @param {String} phone 手机号码
|
|
11
|
+
* @return {String} 131****1111
|
|
12
|
+
*/
|
|
13
|
+
formatPhone(phone: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* 格式化数字 万
|
|
16
|
+
* @param {Number} num
|
|
17
|
+
* @return {String} 12.3万
|
|
18
|
+
*/
|
|
19
|
+
convertToWan(num: number): string | number;
|
|
20
|
+
/**
|
|
21
|
+
* 格式化数字 k
|
|
22
|
+
* @param {Number} num
|
|
23
|
+
* @return {String} 1.2k
|
|
24
|
+
*/
|
|
25
|
+
convertToThousand(num: number): string | number;
|
|
26
|
+
/**
|
|
27
|
+
* 随机数,指定范围
|
|
28
|
+
* @param {Number} min 开始
|
|
29
|
+
* @param {Number} max 结束
|
|
30
|
+
* @return {Number|Object}
|
|
31
|
+
*/
|
|
32
|
+
random(min: number, max: number): number | null;
|
|
33
|
+
/**
|
|
34
|
+
* 格式化金额
|
|
35
|
+
* @param {Number} num
|
|
36
|
+
* @return {String} 123,456
|
|
37
|
+
*/
|
|
38
|
+
formatMoney(money: number | string, signal?: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* 格式化手机号
|
|
41
|
+
* @param {string} number 手机号
|
|
42
|
+
* @returns {string} 格式化后的手机号 12345678901 -> 123 4567 8901
|
|
43
|
+
*/
|
|
44
|
+
formatPhoneNumber(number: string | number): string;
|
|
45
|
+
}
|
|
46
|
+
declare const _default: NumberClass;
|
|
47
|
+
export default _default;
|
|
@@ -1,102 +1,118 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file number 格式化
|
|
3
|
-
* @Author: wanghui
|
|
4
|
-
* @createBy: @2020.05.26
|
|
5
|
-
*/
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
* @
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
* @
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
* @param {Number}
|
|
61
|
-
* @
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*
|
|
74
|
-
* @
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
money =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @file number 格式化
|
|
3
|
+
* @Author: wanghui
|
|
4
|
+
* @createBy: @2020.05.26
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
var NumberClass = /** @class */ (function () {
|
|
9
|
+
function NumberClass() {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 个位数前面补0
|
|
13
|
+
* @param {Number} num 需要格式化的数字
|
|
14
|
+
* @return {String} '01'
|
|
15
|
+
*/
|
|
16
|
+
NumberClass.prototype.formatNumber = function (num) {
|
|
17
|
+
var res = num.toString();
|
|
18
|
+
return res[1] ? res : '0' + res;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* 将手机号中间部分替换为星号
|
|
22
|
+
* @param {String} phone 手机号码
|
|
23
|
+
* @return {String} 131****1111
|
|
24
|
+
*/
|
|
25
|
+
NumberClass.prototype.formatPhone = function (phone) {
|
|
26
|
+
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 格式化数字 万
|
|
30
|
+
* @param {Number} num
|
|
31
|
+
* @return {String} 12.3万
|
|
32
|
+
*/
|
|
33
|
+
NumberClass.prototype.convertToWan = function (num) {
|
|
34
|
+
var result = '';
|
|
35
|
+
if (num < 10000) {
|
|
36
|
+
result = num;
|
|
37
|
+
}
|
|
38
|
+
if (num >= 10000) {
|
|
39
|
+
result = (num / 10000).toFixed(1) + '万';
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* 格式化数字 k
|
|
45
|
+
* @param {Number} num
|
|
46
|
+
* @return {String} 1.2k
|
|
47
|
+
*/
|
|
48
|
+
NumberClass.prototype.convertToThousand = function (num) {
|
|
49
|
+
var result = '';
|
|
50
|
+
if (num < 1000) {
|
|
51
|
+
result = num;
|
|
52
|
+
}
|
|
53
|
+
if (num >= 1000) {
|
|
54
|
+
result = (num / 1000).toFixed(1) + 'k';
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* 随机数,指定范围
|
|
60
|
+
* @param {Number} min 开始
|
|
61
|
+
* @param {Number} max 结束
|
|
62
|
+
* @return {Number|Object}
|
|
63
|
+
*/
|
|
64
|
+
NumberClass.prototype.random = function (min, max) {
|
|
65
|
+
if (arguments.length === 2) {
|
|
66
|
+
return Math.floor(min + Math.random() * ((max + 1) - min));
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* 格式化金额
|
|
74
|
+
* @param {Number} num
|
|
75
|
+
* @return {String} 123,456
|
|
76
|
+
*/
|
|
77
|
+
NumberClass.prototype.formatMoney = function (money, signal) {
|
|
78
|
+
var result = '';
|
|
79
|
+
if (money === '') {
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
money = String(money).replace('.00', '');
|
|
83
|
+
money = money.substring(money.length - 2) === '.0' ? money.replace('.0', '') : money;
|
|
84
|
+
// 小于3位数,直接返回
|
|
85
|
+
if (Number(money) < 1000) {
|
|
86
|
+
return result = money;
|
|
87
|
+
}
|
|
88
|
+
if (money.split('.')[0].length < 3) {
|
|
89
|
+
return result = money;
|
|
90
|
+
}
|
|
91
|
+
signal = signal === '' ? '' : ',';
|
|
92
|
+
var price = money.split('.')[0] + '';
|
|
93
|
+
var pricePoint = money.split('.')[1];
|
|
94
|
+
result = price.length > 6 ?
|
|
95
|
+
"".concat(price.substring(0, price.length - 6)).concat(signal).concat(price.substring(price.length - 6, price.length - 3), ",").concat(price.substring(price.length - 3, price.length))
|
|
96
|
+
:
|
|
97
|
+
"".concat(price.substring(0, price.length - 3)).concat(signal).concat(price.substring(price.length - 3, price.length));
|
|
98
|
+
result = pricePoint ? "".concat(result).concat(signal).concat(pricePoint) : result;
|
|
99
|
+
return result;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* 格式化手机号
|
|
103
|
+
* @param {string} number 手机号
|
|
104
|
+
* @returns {string} 格式化后的手机号 12345678901 -> 123 4567 8901
|
|
105
|
+
*/
|
|
106
|
+
NumberClass.prototype.formatPhoneNumber = function (number) {
|
|
107
|
+
var numStr = String(number).replace(/\s/g, '');
|
|
108
|
+
if (numStr.length < 11) {
|
|
109
|
+
return numStr;
|
|
110
|
+
}
|
|
111
|
+
var firstPart = numStr.slice(0, 3);
|
|
112
|
+
var secondPart = numStr.slice(3, 7);
|
|
113
|
+
var thirdPart = numStr.slice(7, 11);
|
|
114
|
+
return "".concat(firstPart, " ").concat(secondPart, " ").concat(thirdPart);
|
|
115
|
+
};
|
|
116
|
+
return NumberClass;
|
|
117
|
+
}());
|
|
118
|
+
exports.default = new NumberClass();
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
AppCall?: {
|
|
4
|
+
has: (method: string) => boolean;
|
|
5
|
+
openOtherAppUrlRouter: (params: {
|
|
6
|
+
appUrlRouter: string;
|
|
7
|
+
}) => void;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
interface EnvConfig {
|
|
12
|
+
motoAndroidScheme?: string;
|
|
13
|
+
motoIOSScheme?: string;
|
|
14
|
+
APPLINK?: string;
|
|
15
|
+
APPLINKIOS?: string;
|
|
16
|
+
emotofineAndroidScheme?: string;
|
|
17
|
+
emotofineIOSScheme?: string;
|
|
18
|
+
EMOTOFINEAPPLINK?: string;
|
|
19
|
+
EMOTOFINEAPPLINKIOS?: string;
|
|
20
|
+
biaofineAndroidScheme?: string;
|
|
21
|
+
biaofineIOSScheme?: string;
|
|
22
|
+
BIAOFINEAPPLINK?: string;
|
|
23
|
+
BIAOFINEAPPLINKIOS?: string;
|
|
24
|
+
APPLINKPRICE?: string;
|
|
25
|
+
APPLINKPRICEIOS?: string;
|
|
26
|
+
}
|
|
27
|
+
interface OpenAppState {
|
|
28
|
+
state?: {
|
|
29
|
+
openApps?: {
|
|
30
|
+
type?: string;
|
|
31
|
+
href?: string;
|
|
32
|
+
id?: number | string;
|
|
33
|
+
title?: string;
|
|
34
|
+
url?: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
declare class OpenAppClass {
|
|
39
|
+
private env;
|
|
40
|
+
private postJddTrack;
|
|
41
|
+
private trackId;
|
|
42
|
+
private openAppState?;
|
|
43
|
+
private ua;
|
|
44
|
+
private _wx;
|
|
45
|
+
private _android;
|
|
46
|
+
private _isHarmonyos;
|
|
47
|
+
private _ios;
|
|
48
|
+
private _isPrice;
|
|
49
|
+
private currentEnv;
|
|
50
|
+
private appUrl?;
|
|
51
|
+
private appStoreUrl?;
|
|
52
|
+
private underway;
|
|
53
|
+
/**
|
|
54
|
+
* @param {Object} env - 环境配置,必须
|
|
55
|
+
* @param {Function} postJddTrack - 埋点方法,必须
|
|
56
|
+
* @param {String} trackId - 埋点id,可选
|
|
57
|
+
* @param {Object} openAppState - 打开app状态,可选
|
|
58
|
+
*/
|
|
59
|
+
constructor(env: EnvConfig, postJddTrack: (trackId: string, data: {
|
|
60
|
+
tag: string;
|
|
61
|
+
}) => void, trackId?: string, openAppState?: OpenAppState);
|
|
62
|
+
/**
|
|
63
|
+
* 根据域名动态获取配置,保证多项目代码一样
|
|
64
|
+
*/
|
|
65
|
+
getCurrentEnv(): void;
|
|
66
|
+
/**
|
|
67
|
+
* 打开APP主流程
|
|
68
|
+
*/
|
|
69
|
+
invoke(): void;
|
|
70
|
+
getUrl(): string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* 获取打开 app sechma url
|
|
73
|
+
* @returns {string | undefined} 打开app的schema或跳转链接
|
|
74
|
+
* params:params={"type":"","id":0,"name":"","travelId":0}
|
|
75
|
+
* type:原生页面key(必须);id:页面id(可选);subject 短话题、版块名称 或 页面标题(可选);travelId 游记id(可选)
|
|
76
|
+
*/
|
|
77
|
+
getSechmaUrl(): string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* 方法一(推荐):打开APP
|
|
80
|
+
* http://www.cnblogs.com/shadajin/p/5724117.html
|
|
81
|
+
*/
|
|
82
|
+
open(openUrl: string | undefined): string | Promise<unknown> | undefined;
|
|
83
|
+
}
|
|
84
|
+
export default OpenAppClass;
|