@hkdigital/lib-core 0.4.40 → 0.4.41
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/network/loaders/audio/AudioScene.svelte.d.ts +2 -19
- package/dist/network/loaders/audio/AudioScene.svelte.js +1 -11
- package/dist/network/loaders/audio/typedef.d.ts +5 -0
- package/dist/network/loaders/audio/typedef.js +7 -0
- package/dist/network/loaders/base/SceneBase.svelte.d.ts +17 -19
- package/dist/network/loaders/base/SceneBase.svelte.js +16 -10
- package/dist/network/loaders/base/typedef.d.ts +20 -0
- package/dist/network/loaders/base/typedef.js +9 -0
- package/package.json +1 -1
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {object} SourceConfig
|
|
3
|
-
* // property ...
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {object} MemorySource
|
|
7
|
-
* @property {string} label
|
|
8
|
-
* @property {AudioLoader} audioLoader
|
|
9
|
-
* @property {SourceConfig} [config]
|
|
10
|
-
*/
|
|
1
|
+
/** @typedef {import('./typedef.js').MemorySource} MemorySource */
|
|
11
2
|
export default class AudioScene extends SceneBase {
|
|
12
3
|
muted: boolean;
|
|
13
4
|
targetGain: number;
|
|
@@ -77,14 +68,6 @@ export default class AudioScene extends SceneBase {
|
|
|
77
68
|
unmute(): void;
|
|
78
69
|
#private;
|
|
79
70
|
}
|
|
80
|
-
|
|
81
|
-
* // property ...
|
|
82
|
-
*/
|
|
83
|
-
export type SourceConfig = object;
|
|
84
|
-
export type MemorySource = {
|
|
85
|
-
label: string;
|
|
86
|
-
audioLoader: AudioLoader;
|
|
87
|
-
config?: object | undefined;
|
|
88
|
-
};
|
|
71
|
+
export type MemorySource = import("./typedef.js").MemorySource;
|
|
89
72
|
import SceneBase from '../base/SceneBase.svelte.js';
|
|
90
73
|
import AudioLoader from './AudioLoader.svelte.js';
|
|
@@ -3,17 +3,7 @@ import * as expect from '../../../util/expect.js';
|
|
|
3
3
|
import SceneBase from '../base/SceneBase.svelte.js';
|
|
4
4
|
import AudioLoader from './AudioLoader.svelte.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* @typedef {object} SourceConfig
|
|
8
|
-
* // property ...
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {object} MemorySource
|
|
13
|
-
* @property {string} label
|
|
14
|
-
* @property {AudioLoader} audioLoader
|
|
15
|
-
* @property {SourceConfig} [config]
|
|
16
|
-
*/
|
|
6
|
+
/** @typedef {import('./typedef.js').MemorySource} MemorySource */
|
|
17
7
|
|
|
18
8
|
export default class AudioScene extends SceneBase {
|
|
19
9
|
|
|
@@ -14,6 +14,11 @@ export type MemorySourceParams = {
|
|
|
14
14
|
*/
|
|
15
15
|
config?: object | undefined;
|
|
16
16
|
};
|
|
17
|
+
export type MemorySource = {
|
|
18
|
+
label: string;
|
|
19
|
+
audioLoader: import("./AudioLoader.svelte.js").default;
|
|
20
|
+
config?: object | undefined;
|
|
21
|
+
};
|
|
17
22
|
/**
|
|
18
23
|
* // property ...
|
|
19
24
|
*/
|
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
* @property {SourceConfig} [config] - Optional source configuration
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {object} MemorySource
|
|
10
|
+
* @property {string} label
|
|
11
|
+
* @property {import('./AudioLoader.svelte.js').default} audioLoader
|
|
12
|
+
* @property {SourceConfig} [config]
|
|
13
|
+
*/
|
|
14
|
+
|
|
8
15
|
/**
|
|
9
16
|
* @typedef {object} SourceConfig
|
|
10
17
|
* // property ...
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @typedef {import('./typedef.js').SceneLoadingProgress} SceneLoadingProgress */
|
|
1
2
|
/**
|
|
2
3
|
* Base class for scene loaders that manage collections of media sources
|
|
3
4
|
*/
|
|
@@ -13,20 +14,15 @@ export default class SceneBase {
|
|
|
13
14
|
/**
|
|
14
15
|
* Extract the loader from a source object
|
|
15
16
|
*
|
|
16
|
-
* @param {
|
|
17
|
+
* @param {object} source - Source object
|
|
17
18
|
*
|
|
18
|
-
* @returns {
|
|
19
|
+
* @returns {import('../../states/index.js').NetworkLoader} loader
|
|
19
20
|
*/
|
|
20
|
-
getLoaderFromSource(source:
|
|
21
|
+
getLoaderFromSource(source: object): import("../../states/index.js").NetworkLoader;
|
|
21
22
|
/**
|
|
22
23
|
* Get scene loading progress
|
|
23
24
|
*/
|
|
24
|
-
get progress():
|
|
25
|
-
totalBytesLoaded: number;
|
|
26
|
-
totalSize: number;
|
|
27
|
-
sourcesLoaded: number;
|
|
28
|
-
numberOfSources: number;
|
|
29
|
-
};
|
|
25
|
+
get progress(): import("./typedef.js").SceneLoadingProgress;
|
|
30
26
|
/**
|
|
31
27
|
* Get scene abort progress
|
|
32
28
|
*/
|
|
@@ -44,22 +40,24 @@ export default class SceneBase {
|
|
|
44
40
|
abort(): void;
|
|
45
41
|
/**
|
|
46
42
|
* Preload all sources with progress tracking and abort capability
|
|
47
|
-
* - Starts loading and waits for completion
|
|
48
|
-
* - Supports timeout and progress callbacks
|
|
49
|
-
* - Returns object with promise and abort function
|
|
50
43
|
*
|
|
51
44
|
* @param {object} [options]
|
|
52
|
-
* @param {number} [options.timeoutMs=10000]
|
|
53
|
-
*
|
|
45
|
+
* @param {number} [options.timeoutMs=10000]
|
|
46
|
+
* Timeout in milliseconds
|
|
47
|
+
* @param {(progress: SceneLoadingProgress) => void} [options.onProgress]
|
|
48
|
+
* Progress callback function
|
|
54
49
|
*
|
|
55
|
-
* @returns {
|
|
56
|
-
*
|
|
57
|
-
* @returns {Function} returns.abort - Function to abort preloading
|
|
50
|
+
* @returns {{promise: Promise<SceneBase>, abort: Function}}
|
|
51
|
+
* Object with promise that resolves when loaded and abort function
|
|
58
52
|
*/
|
|
59
53
|
preload({ timeoutMs, onProgress }?: {
|
|
60
54
|
timeoutMs?: number | undefined;
|
|
61
|
-
onProgress?:
|
|
62
|
-
}):
|
|
55
|
+
onProgress?: ((progress: SceneLoadingProgress) => void) | undefined;
|
|
56
|
+
}): {
|
|
57
|
+
promise: Promise<SceneBase>;
|
|
58
|
+
abort: Function;
|
|
59
|
+
};
|
|
63
60
|
destroy(): void;
|
|
64
61
|
#private;
|
|
65
62
|
}
|
|
63
|
+
export type SceneLoadingProgress = import("./typedef.js").SceneLoadingProgress;
|
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
|
|
16
16
|
import { waitForState } from '../../../util/svelte.js';
|
|
17
17
|
|
|
18
|
+
/** @typedef {import('./typedef.js').SceneLoadingProgress} SceneLoadingProgress */
|
|
19
|
+
|
|
18
20
|
/**
|
|
19
21
|
* Base class for scene loaders that manage collections of media sources
|
|
20
22
|
*/
|
|
@@ -28,6 +30,7 @@ export default class SceneBase {
|
|
|
28
30
|
return this.state === STATE_LOADED;
|
|
29
31
|
});
|
|
30
32
|
|
|
33
|
+
/** @type {SceneLoadingProgress} */
|
|
31
34
|
#progress = $derived.by(() => {
|
|
32
35
|
let totalSize = 0;
|
|
33
36
|
let totalBytesLoaded = 0;
|
|
@@ -130,9 +133,9 @@ export default class SceneBase {
|
|
|
130
133
|
/**
|
|
131
134
|
* Extract the loader from a source object
|
|
132
135
|
*
|
|
133
|
-
* @param {
|
|
136
|
+
* @param {object} source - Source object
|
|
134
137
|
*
|
|
135
|
-
* @returns {
|
|
138
|
+
* @returns {import('../../states/index.js').NetworkLoader} loader
|
|
136
139
|
*/
|
|
137
140
|
// eslint-disable-next-line no-unused-vars
|
|
138
141
|
getLoaderFromSource(source) {
|
|
@@ -171,21 +174,24 @@ export default class SceneBase {
|
|
|
171
174
|
|
|
172
175
|
/**
|
|
173
176
|
* Preload all sources with progress tracking and abort capability
|
|
174
|
-
* - Starts loading and waits for completion
|
|
175
|
-
* - Supports timeout and progress callbacks
|
|
176
|
-
* - Returns object with promise and abort function
|
|
177
177
|
*
|
|
178
178
|
* @param {object} [options]
|
|
179
|
-
* @param {number} [options.timeoutMs=10000]
|
|
180
|
-
*
|
|
179
|
+
* @param {number} [options.timeoutMs=10000]
|
|
180
|
+
* Timeout in milliseconds
|
|
181
|
+
* @param {(progress: SceneLoadingProgress) => void} [options.onProgress]
|
|
182
|
+
* Progress callback function
|
|
181
183
|
*
|
|
182
|
-
* @returns {
|
|
183
|
-
*
|
|
184
|
-
* @returns {Function} returns.abort - Function to abort preloading
|
|
184
|
+
* @returns {{promise: Promise<SceneBase>, abort: Function}}
|
|
185
|
+
* Object with promise that resolves when loaded and abort function
|
|
185
186
|
*/
|
|
186
187
|
preload({ timeoutMs = 10000, onProgress } = {}) {
|
|
188
|
+
|
|
189
|
+
/** @type {number|NodeJS.Timeout|null} */
|
|
187
190
|
let timeoutId = null;
|
|
191
|
+
|
|
192
|
+
/** @type {number|NodeJS.Timeout|null} */
|
|
188
193
|
let progressIntervalId = null;
|
|
194
|
+
|
|
189
195
|
let isAborted = false;
|
|
190
196
|
|
|
191
197
|
const abort = () => {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const _default: {};
|
|
2
|
+
export default _default;
|
|
3
|
+
export type SceneLoadingProgress = {
|
|
4
|
+
/**
|
|
5
|
+
* - Total bytes loaded across all sources
|
|
6
|
+
*/
|
|
7
|
+
totalBytesLoaded: number;
|
|
8
|
+
/**
|
|
9
|
+
* - Total size across all sources
|
|
10
|
+
*/
|
|
11
|
+
totalSize: number;
|
|
12
|
+
/**
|
|
13
|
+
* - Number of sources fully loaded
|
|
14
|
+
*/
|
|
15
|
+
sourcesLoaded: number;
|
|
16
|
+
/**
|
|
17
|
+
* - Total number of sources
|
|
18
|
+
*/
|
|
19
|
+
numberOfSources: number;
|
|
20
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} SceneLoadingProgress
|
|
3
|
+
* @property {number} totalBytesLoaded - Total bytes loaded across all sources
|
|
4
|
+
* @property {number} totalSize - Total size across all sources
|
|
5
|
+
* @property {number} sourcesLoaded - Number of sources fully loaded
|
|
6
|
+
* @property {number} numberOfSources - Total number of sources
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export default {};
|