/** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var types = {}; var FileTypesManager = { /** * Static method called when a LoaderPlugin is created. * * Loops through the local types object and injects all of them as * properties into the LoaderPlugin instance. * * @method Phaser.Loader.FileTypesManager.register * @since 3.0.0 * * @param {Phaser.Loader.LoaderPlugin} loader - The LoaderPlugin to install the types into. */ install: function (loader) { for (var key in types) { loader[key] = types[key]; } }, /** * Static method called directly by the File Types. * * The key is a reference to the function used to load the files via the Loader, i.e. `image`. * * @method Phaser.Loader.FileTypesManager.register * @since 3.0.0 * * @param {string} key - The key that will be used as the method name in the LoaderPlugin. * @param {function} factoryFunction - The function that will be called when LoaderPlugin.key is invoked. */ register: function (key, factoryFunction) { types[key] = factoryFunction; }, /** * Removed all associated file types. * * @method Phaser.Loader.FileTypesManager.destroy * @since 3.0.0 */ destroy: function () { types = {}; } }; module.exports = FileTypesManager;