UNPKG

starling-framework

Version:

A fast, productive library for 2D cross-platform development.

69 lines 2.7 kB
import AssetManager from "./AssetManager"; import ByteArray from "openfl/utils/ByteArray"; declare namespace starling.assets { /** * A helper class that's passed to an AssetFactory's "create" method. */ export class AssetFactoryHelper { /** * @private */ protected constructor(); /** * Forwarded to the AssetManager's method with the same name. */ getNameFromUrl(url: string): string; /** * Forwarded to the AssetManager's method with the same name. */ getExtensionFromUrl(url: string): string; /** * Accesses a URL (local or remote) and passes the loaded ByteArray to the * * 'onComplete' callback - or executes 'onError' when the data can't be loaded. * * * * @param url a string containing an URL. * * @param onComplete function(data:ByteArray, mimeType:String):void; * * @param onError function(error:String):void; * */ loadDataFromUrl(url: string, onComplete: (arg0?: ByteArray, arg1?: string, arg2?: string, arg3?: string) => void, onError: (arg0: string) => void): void; /** * Adds a method to be called by the AssetManager when the queue has finished processing. * * Useful e.g. if assets depend on other assets (like an atlas XML depending on the atlas * * texture). * * * * @param processor function(manager:AssetManager):void; * * @param priority Processors with a higher priority will be called first. * * The default processor for texture atlases is called with a * * priority of '100', others with '0'. * */ addPostProcessor(processor: (arg0: AssetManager) => void, priority?: number): void; /** * Textures are required to call this method when they begin their restoration process * * after a context loss. */ onBeginRestore(): void; /** * Textures are required to call this method when they have finished their restoration * * process after a context loss. */ onEndRestore(): void; /** * Forwarded to the AssetManager's method with the same name. */ log(message: string): void; /** * Adds additional assets to the AssetManager. To be called when the factory * * creates more than one asset. */ addComplementaryAsset(name: string, asset: any, type?: string): void; /** * Delay the execution of 'call' until it's allowed. (On mobile, the context * * may not be accessed while the application is in the background.) * */ executeWhenContextReady(call: Function, args?: Array<any>): void; } } export default starling.assets.AssetFactoryHelper;