@microbt/environment 1.2.0 → 1.2.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/dist/esm/arms.js +31 -10
- package/package.json +1 -1
package/dist/esm/arms.js
CHANGED
|
@@ -1,52 +1,73 @@
|
|
|
1
1
|
// src/arms.ts
|
|
2
|
+
import Logger from "./logger";
|
|
2
3
|
var api = (params) => {
|
|
3
|
-
if (window.__bl) {
|
|
4
|
+
if (window.__bl && typeof window.__bl.api === "function") {
|
|
4
5
|
window.__bl.api(params);
|
|
6
|
+
} else {
|
|
7
|
+
Logger.error("window.__bl.api is not a function");
|
|
5
8
|
}
|
|
6
9
|
};
|
|
7
10
|
var error = (e, pos) => {
|
|
8
|
-
if (window.__bl) {
|
|
11
|
+
if (window.__bl && typeof window.__bl.error === "function") {
|
|
9
12
|
window.__bl.error(e, pos);
|
|
13
|
+
} else {
|
|
14
|
+
Logger.error("window.__bl.error is not a function");
|
|
10
15
|
}
|
|
11
16
|
};
|
|
12
17
|
var sum = (key, value) => {
|
|
13
|
-
if (window.__bl) {
|
|
18
|
+
if (window.__bl && typeof window.__bl.sum === "function") {
|
|
14
19
|
window.__bl.sum(key, value);
|
|
20
|
+
} else {
|
|
21
|
+
Logger.error("window.__bl.sum is not a function");
|
|
15
22
|
}
|
|
16
23
|
};
|
|
17
24
|
var avg = (key, value) => {
|
|
18
|
-
if (window.__bl) {
|
|
25
|
+
if (window.__bl && typeof window.__bl.avg === "function") {
|
|
19
26
|
window.__bl.avg(key, value);
|
|
27
|
+
} else {
|
|
28
|
+
Logger.error("window.__bl.avg is not a function");
|
|
20
29
|
}
|
|
21
30
|
};
|
|
22
31
|
var reportBehavior = () => {
|
|
23
|
-
if (window.__bl) {
|
|
32
|
+
if (window.__bl && typeof window.__bl.reportBehavior === "function") {
|
|
24
33
|
window.__bl.reportBehavior();
|
|
34
|
+
} else {
|
|
35
|
+
Logger.error("window.__bl.reportBehavior is not a function");
|
|
25
36
|
}
|
|
26
37
|
};
|
|
27
38
|
var performance = (params) => {
|
|
28
|
-
if (window.__bl) {
|
|
39
|
+
if (window.__bl && typeof window.__bl.performance === "function") {
|
|
29
40
|
window.__bl.performance(params);
|
|
41
|
+
} else {
|
|
42
|
+
Logger.error("window.__bl.performance is not a function");
|
|
30
43
|
}
|
|
31
44
|
};
|
|
32
45
|
var setConfig = (params) => {
|
|
33
|
-
if (window.__bl) {
|
|
46
|
+
if (window.__bl && typeof window.__bl.setConfig === "function") {
|
|
34
47
|
window.__bl.setConfig(params);
|
|
48
|
+
} else {
|
|
49
|
+
Logger.error("window.__bl.setConfig is not a function");
|
|
35
50
|
}
|
|
36
51
|
};
|
|
37
52
|
var setPage = (page, sendPv) => {
|
|
38
|
-
if (window.__bl) {
|
|
53
|
+
if (window.__bl && typeof window.__bl.setPage === "function") {
|
|
39
54
|
window.__bl.setPage(page, sendPv);
|
|
55
|
+
} else {
|
|
56
|
+
Logger.error("window.__bl.setPage is not a function");
|
|
40
57
|
}
|
|
41
58
|
};
|
|
42
59
|
var setCommonInfo = (params) => {
|
|
43
|
-
if (window.__bl) {
|
|
60
|
+
if (window.__bl && typeof window.__bl.setCommonInfo === "function") {
|
|
44
61
|
window.__bl.setCommonInfo(params);
|
|
62
|
+
} else {
|
|
63
|
+
Logger.error("window.__bl.setCommonInfo is not a function");
|
|
45
64
|
}
|
|
46
65
|
};
|
|
47
66
|
var addBehavior = (data, page) => {
|
|
48
|
-
if (window.__bl) {
|
|
67
|
+
if (window.__bl && typeof window.__bl.addBehavior === "function") {
|
|
49
68
|
window.__bl.addBehavior(data, page);
|
|
69
|
+
} else {
|
|
70
|
+
Logger.error("window.__bl.addBehavior is not a function");
|
|
50
71
|
}
|
|
51
72
|
};
|
|
52
73
|
var arms = {
|