@league-of-foundry-developers/foundry-vtt-types 9.269.1 → 9.280.0
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/package.json
CHANGED
@@ -2,14 +2,9 @@ import type { ConfiguredDocumentClassForName } from '../../../../types/helperTyp
|
|
2
2
|
|
3
3
|
declare global {
|
4
4
|
/**
|
5
|
-
* A Loader class which helps with loading video and image textures
|
5
|
+
* A Loader class which helps with loading video and image textures.
|
6
6
|
*/
|
7
7
|
class TextureLoader {
|
8
|
-
/**
|
9
|
-
* The cached mapping of textures
|
10
|
-
*/
|
11
|
-
cache: Map<string, { tex: PIXI.BaseTexture; time: number }>;
|
12
|
-
|
13
8
|
/**
|
14
9
|
* The duration in milliseconds for which a texture will remain cached
|
15
10
|
* @defaultValue `1000 * 60 * 15`
|
@@ -43,51 +38,26 @@ declare global {
|
|
43
38
|
loadTexture(src: string): Promise<PIXI.BaseTexture>;
|
44
39
|
|
45
40
|
/**
|
46
|
-
*
|
47
|
-
* @
|
41
|
+
* Load an image texture from a provided source url.
|
42
|
+
* @param src - The source image URL
|
43
|
+
* @returns The loaded BaseTexture
|
48
44
|
*/
|
49
|
-
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Log failed texture loading
|
53
|
-
* @internal
|
54
|
-
*/
|
55
|
-
protected _onError(src: string, progress: TextureLoader.Progress, error: Error): void;
|
45
|
+
loadImageTexture(src: string): Promise<PIXI.BaseTexture>;
|
56
46
|
|
57
47
|
/**
|
58
|
-
*
|
48
|
+
* @param src - The source video URL
|
49
|
+
* @returns The loaded BaseTexture
|
59
50
|
*/
|
60
|
-
|
51
|
+
loadVideoTexture(src: string): Promise<PIXI.BaseTexture>;
|
61
52
|
|
62
53
|
/**
|
63
54
|
* Use the Fetch API to retrieve a resource and return a Blob instance for it.
|
55
|
+
* @param src -
|
64
56
|
* @param options - Options to configure the loading behaviour.
|
65
57
|
* (default: `{}`)
|
66
|
-
* @
|
67
|
-
*/
|
68
|
-
protected _fetchResource(
|
69
|
-
src: string,
|
70
|
-
options?: {
|
71
|
-
/**
|
72
|
-
* Append a cache-busting query parameter to the request.
|
73
|
-
* @defaultValue `false`
|
74
|
-
*/
|
75
|
-
bustCache?: boolean | undefined;
|
76
|
-
}
|
77
|
-
): Promise<Blob>;
|
78
|
-
|
79
|
-
/**
|
80
|
-
* Return a URL with a cache-busting query parameter appended.
|
81
|
-
* @param src - The source URL being attempted
|
82
|
-
* @returns The new URL, or false on a failure.
|
83
|
-
* @internal
|
58
|
+
* @returns A Blob containing the loaded data
|
84
59
|
*/
|
85
|
-
|
86
|
-
|
87
|
-
/**
|
88
|
-
* Load a video texture from a provided source url
|
89
|
-
*/
|
90
|
-
loadVideoTexture(src: string): Promise<PIXI.BaseTexture>;
|
60
|
+
static fetchResource(src: string, options?: TextureLoader.FetchResourceOptions): Promise<Blob>;
|
91
61
|
|
92
62
|
/**
|
93
63
|
* Add an image url to the texture cache
|
@@ -107,6 +77,13 @@ declare global {
|
|
107
77
|
*/
|
108
78
|
expireCache(): void;
|
109
79
|
|
80
|
+
/**
|
81
|
+
* Return a URL with a cache-busting query parameter appended.
|
82
|
+
* @param src - The source URL being attempted
|
83
|
+
* @returns The new URL, or false on a failure.
|
84
|
+
*/
|
85
|
+
static getCacheBustURL(src: string): string | false;
|
86
|
+
|
110
87
|
/**
|
111
88
|
* A global reference to the singleton texture loader
|
112
89
|
*/
|
@@ -142,6 +119,14 @@ declare global {
|
|
142
119
|
total: number;
|
143
120
|
pct: number;
|
144
121
|
}
|
122
|
+
|
123
|
+
interface FetchResourceOptions {
|
124
|
+
/**
|
125
|
+
* Append a cache-busting query parameter to the request.
|
126
|
+
* @defaultValue `false`
|
127
|
+
*/
|
128
|
+
bustCache?: boolean;
|
129
|
+
}
|
145
130
|
}
|
146
131
|
|
147
132
|
/**
|
@@ -160,11 +145,12 @@ declare global {
|
|
160
145
|
* Load a single texture and return a Promise which resolves once the texture is ready to use
|
161
146
|
* @param src - The requested texture source
|
162
147
|
* @param options - Additional options which modify texture loading
|
148
|
+
* @returns The loaded Texture, or null if loading failed with no fallback
|
163
149
|
*/
|
164
150
|
function loadTexture(
|
165
151
|
src: string,
|
166
152
|
options?: {
|
167
|
-
/** A fallback texture to use if the requested source is unavailable
|
153
|
+
/** A fallback texture URL to use if the requested source is unavailable */
|
168
154
|
fallback?: string | undefined;
|
169
155
|
}
|
170
156
|
): Promise<PIXI.Texture | null>;
|