@hkdigital/lib-core 0.4.44 → 0.4.45
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.
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
LOAD,
|
|
11
11
|
LOADED,
|
|
12
12
|
ABORT,
|
|
13
|
-
ABORTED
|
|
13
|
+
ABORTED,
|
|
14
|
+
ERROR
|
|
14
15
|
} from '../../../state/machines.js';
|
|
15
16
|
|
|
16
17
|
import { waitForState } from '../../../util/svelte.js';
|
|
@@ -108,6 +109,20 @@ export default class SceneBase {
|
|
|
108
109
|
}
|
|
109
110
|
});
|
|
110
111
|
|
|
112
|
+
$effect(() => {
|
|
113
|
+
if (this.#state.current === STATE_LOADING) {
|
|
114
|
+
// Check if any source failed during loading
|
|
115
|
+
const sources = this.sources;
|
|
116
|
+
for (const source of sources) {
|
|
117
|
+
const loader = this.getLoaderFromSource(source);
|
|
118
|
+
if (loader.state === STATE_ERROR) {
|
|
119
|
+
this.#state.send(ERROR, loader.error || new Error('Source loading failed'));
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
111
126
|
state.onenter = (currentState) => {
|
|
112
127
|
if (currentState === STATE_LOADING) {
|
|
113
128
|
this.#startLoading();
|
|
@@ -253,7 +268,7 @@ export default class SceneBase {
|
|
|
253
268
|
if (isAborted || this.state === STATE_ABORTED) {
|
|
254
269
|
reject(new Error('Preload was aborted'));
|
|
255
270
|
} else if (this.state === STATE_ERROR) {
|
|
256
|
-
reject(
|
|
271
|
+
reject(this.#state.error);
|
|
257
272
|
} else if (this.loaded) {
|
|
258
273
|
resolve(this);
|
|
259
274
|
} else {
|