@inappstory/game-center-api 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/lib/sdkApi/initGame.js +61 -5
- package/package.json +1 -1
package/lib/sdkApi/initGame.js
CHANGED
|
@@ -17,7 +17,7 @@ const gameReader = (function () {
|
|
|
17
17
|
const self = (window.gameReader || {});
|
|
18
18
|
self._e = self._e || [];
|
|
19
19
|
if (self._e) {
|
|
20
|
-
for (let i = 0; i < self._e.length; i
|
|
20
|
+
for (let i = 0; i < self._e.length; ++i) {
|
|
21
21
|
setTimeout((function (cb, i) {
|
|
22
22
|
return function () {
|
|
23
23
|
try {
|
|
@@ -29,13 +29,54 @@ const gameReader = (function () {
|
|
|
29
29
|
}
|
|
30
30
|
catch (e) {
|
|
31
31
|
window._sendErrorLog &&
|
|
32
|
-
window._sendErrorLog({
|
|
32
|
+
window._sendErrorLog({
|
|
33
|
+
src: "gameReaderInit queue",
|
|
34
|
+
message: e.message,
|
|
35
|
+
stack: e.stack,
|
|
36
|
+
});
|
|
33
37
|
console.error(e);
|
|
34
38
|
}
|
|
35
39
|
};
|
|
36
40
|
})(self._e[i], i));
|
|
37
41
|
}
|
|
38
42
|
}
|
|
43
|
+
if (window.Android && window.sessionStorage != null) {
|
|
44
|
+
try {
|
|
45
|
+
/**
|
|
46
|
+
* _initQueue in session storage
|
|
47
|
+
* it is fallback for case when initCode runs before window changed from _blank to game associated window
|
|
48
|
+
*/
|
|
49
|
+
const _initQueue = JSON.parse(window.sessionStorage.getItem("_initQueue") || "[]");
|
|
50
|
+
if (Array.isArray(_initQueue)) {
|
|
51
|
+
for (let i = 0; i < _initQueue.length; ++i) {
|
|
52
|
+
setTimeout((function (cb, i) {
|
|
53
|
+
return function () {
|
|
54
|
+
try {
|
|
55
|
+
window.gameLoadingInfo.state = "before call gameReaderInit sessionStorage queue";
|
|
56
|
+
window.gameLoadingInfo.description = "index: " + i;
|
|
57
|
+
eval(cb);
|
|
58
|
+
window.gameLoadingInfo.state = "after call gameReaderInit sessionStorage queue";
|
|
59
|
+
window.gameLoadingInfo.description = "index: " + i;
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
window._sendErrorLog &&
|
|
63
|
+
window._sendErrorLog({
|
|
64
|
+
src: "gameReaderInit sessionStorage queue",
|
|
65
|
+
message: e.message,
|
|
66
|
+
stack: e.stack,
|
|
67
|
+
});
|
|
68
|
+
console.error(e);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
})(_initQueue[i], i));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
window.sessionStorage.removeItem("_initQueue");
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
console.error(e);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
39
80
|
self.ready = function (cb) {
|
|
40
81
|
setTimeout(function () {
|
|
41
82
|
try {
|
|
@@ -46,7 +87,12 @@ const gameReader = (function () {
|
|
|
46
87
|
window.gameLoadingInfo.description = "";
|
|
47
88
|
}
|
|
48
89
|
catch (e) {
|
|
49
|
-
window._sendErrorLog &&
|
|
90
|
+
window._sendErrorLog &&
|
|
91
|
+
window._sendErrorLog({
|
|
92
|
+
src: "gameReaderInit ready",
|
|
93
|
+
message: e.message,
|
|
94
|
+
stack: e.stack,
|
|
95
|
+
});
|
|
50
96
|
console.error(e);
|
|
51
97
|
}
|
|
52
98
|
});
|
|
@@ -78,7 +124,12 @@ const createInitGame = (initLocalData, mounted = () => { }) => {
|
|
|
78
124
|
window.gameLoadingInfo.description = JSON.stringify(config);
|
|
79
125
|
}
|
|
80
126
|
catch (e) {
|
|
81
|
-
window._sendErrorLog &&
|
|
127
|
+
window._sendErrorLog &&
|
|
128
|
+
window._sendErrorLog({
|
|
129
|
+
src: "initGame",
|
|
130
|
+
message: e.message,
|
|
131
|
+
stack: e.stack,
|
|
132
|
+
});
|
|
82
133
|
console.error(e);
|
|
83
134
|
}
|
|
84
135
|
};
|
|
@@ -146,7 +197,12 @@ const gameLoadedSdkCallback = (config) => {
|
|
|
146
197
|
}
|
|
147
198
|
}
|
|
148
199
|
catch (e) {
|
|
149
|
-
window._sendErrorLog &&
|
|
200
|
+
window._sendErrorLog &&
|
|
201
|
+
window._sendErrorLog({
|
|
202
|
+
src: "gameLoadedSdkCallback",
|
|
203
|
+
message: e.message,
|
|
204
|
+
stack: e.stack,
|
|
205
|
+
});
|
|
150
206
|
console.error(e);
|
|
151
207
|
}
|
|
152
208
|
};
|