mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-01-31 05:07:11 +00:00
30 lines
685 B
TypeScript
30 lines
685 B
TypeScript
let manifest: object;
|
|
|
|
export default class CacheBustedLoaderPlugin extends Phaser.Loader.LoaderPlugin {
|
|
constructor(scene: Phaser.Scene) {
|
|
super(scene)
|
|
}
|
|
|
|
get manifest() {
|
|
return manifest;
|
|
}
|
|
|
|
set manifest(manifestObj: object) {
|
|
manifest = manifestObj;
|
|
}
|
|
|
|
addFile(file): void {
|
|
if (!Array.isArray(file))
|
|
file = [ file ];
|
|
|
|
file.forEach(item => {
|
|
if (manifest) {
|
|
const timestamp = manifest[`/${item.url.replace(/\/\//g, '/')}` ];
|
|
if (timestamp)
|
|
item.url += `?t=${timestamp}`;
|
|
}
|
|
});
|
|
|
|
super.addFile(file);
|
|
}
|
|
} |