kitchen-simulator 5.10.5-react.18 → 5.10.6-react.18
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/es/index.js +35 -19
- package/package.json +1 -1
package/es/index.js
CHANGED
|
@@ -140,8 +140,14 @@ function installGltfTracker() {
|
|
|
140
140
|
if (g.inFlight < 0) g.inFlight = 0;
|
|
141
141
|
notify();
|
|
142
142
|
_this.removeEventListener('loadend', _done);
|
|
143
|
+
_this.removeEventListener('error', _done);
|
|
144
|
+
_this.removeEventListener('abort', _done);
|
|
145
|
+
_this.removeEventListener('timeout', _done);
|
|
143
146
|
};
|
|
144
147
|
this.addEventListener('loadend', _done);
|
|
148
|
+
this.addEventListener('error', _done);
|
|
149
|
+
this.addEventListener('abort', _done);
|
|
150
|
+
this.addEventListener('timeout', _done);
|
|
145
151
|
}
|
|
146
152
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
147
153
|
args[_key2] = arguments[_key2];
|
|
@@ -240,13 +246,11 @@ function installGltfTracker() {
|
|
|
240
246
|
var _ref3,
|
|
241
247
|
_ref3$timeoutMs,
|
|
242
248
|
timeoutMs,
|
|
243
|
-
start,
|
|
244
249
|
_args4 = arguments;
|
|
245
250
|
return _regeneratorRuntime.wrap(function (_context4) {
|
|
246
251
|
while (1) switch (_context4.prev = _context4.next) {
|
|
247
252
|
case 0:
|
|
248
253
|
_ref3 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref3$timeoutMs = _ref3.timeoutMs, timeoutMs = _ref3$timeoutMs === void 0 ? 30000 : _ref3$timeoutMs;
|
|
249
|
-
start = Date.now();
|
|
250
254
|
_context4.next = 1;
|
|
251
255
|
return waitStableIdle2Frames();
|
|
252
256
|
case 1:
|
|
@@ -258,38 +262,50 @@ function installGltfTracker() {
|
|
|
258
262
|
case 2:
|
|
259
263
|
return _context4.abrupt("return", new Promise(function (resolve, reject) {
|
|
260
264
|
var unsub = null;
|
|
265
|
+
var finished = false;
|
|
266
|
+
var finishOk = function finishOk() {
|
|
267
|
+
if (finished) return;
|
|
268
|
+
finished = true;
|
|
269
|
+
if (unsub) unsub();
|
|
270
|
+
clearTimeout(timer);
|
|
271
|
+
resolve(true);
|
|
272
|
+
};
|
|
273
|
+
var finishErr = function finishErr(err) {
|
|
274
|
+
if (finished) return;
|
|
275
|
+
finished = true;
|
|
276
|
+
if (unsub) unsub();
|
|
277
|
+
clearTimeout(timer);
|
|
278
|
+
reject(err);
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
// ✅ Real timeout no matter what happens with inFlight changes
|
|
282
|
+
var timer = setTimeout(function () {
|
|
283
|
+
finishErr(new Error('3D assets did not become idle within timeout'));
|
|
284
|
+
}, timeoutMs);
|
|
261
285
|
var onChange = /*#__PURE__*/function () {
|
|
262
286
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(count) {
|
|
263
287
|
var stable;
|
|
264
288
|
return _regeneratorRuntime.wrap(function (_context3) {
|
|
265
289
|
while (1) switch (_context3.prev = _context3.next) {
|
|
266
290
|
case 0:
|
|
267
|
-
if (!
|
|
291
|
+
if (!finished) {
|
|
268
292
|
_context3.next = 1;
|
|
269
293
|
break;
|
|
270
294
|
}
|
|
271
|
-
if (Date.now() - start > timeoutMs) {
|
|
272
|
-
if (unsub) unsub();
|
|
273
|
-
reject(new Error('3D assets did not become idle within timeout'));
|
|
274
|
-
}
|
|
275
295
|
return _context3.abrupt("return");
|
|
276
296
|
case 1:
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
case 2:
|
|
280
|
-
stable = _context3.sent;
|
|
281
|
-
if (!stable) {
|
|
282
|
-
_context3.next = 3;
|
|
297
|
+
if (!(count !== 0)) {
|
|
298
|
+
_context3.next = 2;
|
|
283
299
|
break;
|
|
284
300
|
}
|
|
285
|
-
if (unsub) unsub();
|
|
286
|
-
resolve(true);
|
|
287
301
|
return _context3.abrupt("return");
|
|
302
|
+
case 2:
|
|
303
|
+
_context3.next = 3;
|
|
304
|
+
return waitStableIdle2Frames();
|
|
288
305
|
case 3:
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
306
|
+
stable = _context3.sent;
|
|
307
|
+
if (stable) finishOk();
|
|
308
|
+
// else keep waiting
|
|
293
309
|
case 4:
|
|
294
310
|
case "end":
|
|
295
311
|
return _context3.stop();
|