- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
import type { ExtensionMetadata } from '@pixi/core';
import { ExtensionType } from '@pixi/core';
import { Loader } from './Loader';
/**
* Application plugin for supporting loader option. Installing the LoaderPlugin
* is not necessary if using **pixi.js** or **pixi.js-legacy**.
* @example
* import {AppLoaderPlugin} from '@pixi/loaders';
* import {extensions} from '@pixi/core';
* extensions.add(AppLoaderPlugin);
* @memberof PIXI
*/
export class AppLoaderPlugin
{
/** @ignore */
static extension: ExtensionMetadata = ExtensionType.Application;
/**
* Loader instance to help with asset loading.
* @memberof PIXI.Application#
* @readonly
*/
public static loader: Loader;
/**
* Called on application constructor
* @param options
* @private
*/
static init(options?: GlobalMixins.IApplicationOptions): void
{
options = Object.assign({
sharedLoader: false,
}, options);
this.loader = options.sharedLoader ? Loader.shared : new Loader();
}
/**
* Called when application destroyed
* @private
*/
static destroy(): void
{
if (this.loader)
{
this.loader.destroy();
this.loader = null;
}
}
}