import { EventDispatcher } from '../events/EventDispatcher'; import { EventBase } from '../events/EventBase'; import { URLRequest } from '../net/URLRequest'; import { ParserBase } from '../parsers/ParserBase'; import { AssetLibraryIterator } from './AssetLibraryIterator'; import { ConflictStrategyBase } from './ConflictStrategyBase'; import { IAssetAdapter } from './IAssetAdapter'; import { Loader } from './Loader'; import { LoaderContext } from './LoaderContext'; /** * AssetLibraryBundle enforces a multiton pattern and is not intended to be * instanced directly. Its purpose is to create a container for 3D data * management, both before and after parsing. If you are interested in creating * multiple library bundles, please use the getInstance() method. */ export declare class AssetLibraryBundle extends EventDispatcher { static _iInstances: Object; private _loaderSessions; private _strategy; private _strategyPreference; private _assets; private _assetDictionary; private _assetDictDirty; private _loaderSessionsGarbage; private _onAssetRenameDelegate; private _onAssetConflictResolvedDelegate; private _onLoaderStartDelegate; private _onLoaderCompleteDelegate; private _onTextureSizeErrorDelegate; private _onAssetCompleteDelegate; private _onLoadErrorDelegate; private _onParseErrorDelegate; private _errorDelegateSelector; /** * Creates a new AssetLibraryBundle object. * * @param me A multiton enforcer for the AssetLibraryBundle ensuring it cannnot be instanced. */ constructor(); /** * Special addEventListener case for URLLoaderEvent.LOAD_ERROR * and ype == ParserEvent.PARSE_ERROR * * @param type * @param listener */ addEventListener(type: string, listener: (event: EventBase) => void): void; /** * Special removeEventListener case for * URLLoaderEvent.LOAD_ERROR and ype == * ParserEvent.PARSE_ERROR * * @param type * @param listener */ removeEventListener(type: string, listener: (event: EventBase) => void): void; /** * Returns an AssetLibraryBundle instance. If no key is given, returns the * default bundle instance (which is similar to using the AssetLibraryBundle * as a singleton.) To keep several separated library bundles, pass a string * key to this method to define which bundle should be returned. This is * referred to as using the AssetLibrary as a multiton. * * @param key Defines which multiton instance should be returned. * @return An instance of the asset library */ static getInstance(key?: string): AssetLibraryBundle; /** * */ enableParser(parserClass: Object): void; /** * */ enableParsers(parserClasses: Object[]): void; /** * Defines which strategy should be used for resolving naming conflicts, * when two library assets are given the same name. By default, * ConflictStrategy.APPEND_NUM_SUFFIX is used which means that * a numeric suffix is appended to one of the assets. The * conflictPrecedence property defines which of the two * conflicting assets will be renamed. * * @see naming.ConflictStrategy * @see AssetLibrary.conflictPrecedence */ get conflictStrategy(): ConflictStrategyBase; set conflictStrategy(val: ConflictStrategyBase); /** * Defines which asset should have precedence when resolving a naming * conflict between two assets of which one has just been renamed by the * user or by a parser. By default ConflictPrecedence.FAVOR_NEW * is used, meaning that the newly renamed asset will keep it's new name * while the older asset gets renamed to not conflict. * * This property is ignored for conflict strategies that do not actually * rename an asset automatically, such as ConflictStrategy.IGNORE and * ConflictStrategy.THROW_ERROR. * * @see away.library.ConflictPrecedence * @see away.library.ConflictStrategy */ get conflictPrecedence(): string; set conflictPrecedence(val: string); /** * Create an AssetLibraryIterator instance that can be used to iterate over * the assets in this asset library instance. The iterator can filter assets * on asset type and/or namespace. A "null" filter value means no filter of * that type is used. * * @param assetTypeFilter Asset type to filter on (from the AssetType enum * class.) Use null to not filter on asset type. * @param namespaceFilter Namespace to filter on. Use null to not filter on * namespace. * @param filterFunc Callback function to use when deciding whether an asset * should be included in the iteration or not. This needs to be a function * that takes a single parameter of type IAsset and returns a boolean where * true means it should be included. * * @see away.library.AssetType */ createIterator(assetTypeFilter?: string, namespaceFilter?: string, filterFunc?: any): AssetLibraryIterator; /** * Loads a file and (optionally) all of its dependencies. * * @param req The URLRequest object containing the URL of the file to be * loaded. * @param context An optional context object providing additional parameters * for loading * @param ns An optional namespace string under which the file is to be * loaded, allowing the differentiation of two resources with identical * assets * @param parser An optional parser object for translating the loaded data * into a usable resource. If not provided, Loader will attempt to * auto-detect the file type. * @return A handle to the retrieved resource. */ load(req: URLRequest, context?: LoaderContext, ns?: string, parser?: ParserBase): void; /** * Loads a resource from existing data in memory. * * @param data The data object containing all resource information. * @param context An optional context object providing additional parameters * for loading * @param ns An optional namespace string under which the file is to be * loaded, allowing the differentiation of two resources with identical * assets * @param parser An optional parser object for translating the loaded data * into a usable resource. If not provided, Loader will attempt to * auto-detect the file type. * @return A handle to the retrieved resource. */ loadData(data: any, context?: LoaderContext, ns?: string, parser?: ParserBase): void; getLoader(): Loader; stopLoader(loader: Loader): void; /** * */ getAsset(name: string, ns?: string): IAssetAdapter; getAllAssets(): Array; /** * Adds an asset to the asset library, first making sure that it's name is * unique using the method defined by the conflictStrategy and * conflictPrecedence properties. */ addAsset(asset: IAssetAdapter): void; /** * Removes an asset from the library, and optionally disposes that asset by * calling it's disposeAsset() method (which for most assets is implemented * as a default version of that type's dispose() method. * * @param asset The asset which should be removed from this library. * @param dispose Defines whether the assets should also be disposed. */ removeAsset(asset: IAssetAdapter, dispose?: boolean): void; /** * Removes an asset which is specified using name and namespace. * * @param name The name of the asset to be removed. * @param ns The namespace to which the desired asset belongs. * @param dispose Defines whether the assets should also be disposed. * * @see away.library.AssetLibrary.removeAsset() */ removeAssetByName(name: string, ns?: string, dispose?: boolean): IAssetAdapter; /** * Removes all assets from the asset library, optionally disposing them as * they are removed. * * @param dispose Defines whether the assets should also be disposed. */ removeAllAssets(dispose?: boolean): void; /** * Removes all assets belonging to a particular namespace (null for default) * from the asset library, and optionall disposes them by calling their * disposeAsset() method. * * @param ns The namespace from which all assets should be removed. * @param dispose Defines whether the assets should also be disposed. * * @see away.library.AssetLibrary.removeAsset() */ removeNamespaceAssets(ns?: string, dispose?: boolean): void; private removeAssetFromDict; stop(): void; private rehashAssetDict; /** * Called when a an error occurs during loading. */ private _onLoadError; /** * Called when a an error occurs during parsing. */ private _onParseError; private _onAssetComplete; private _onTextureSizeError; private _onLoaderStart; /** * Called when the resource and all of its dependencies was retrieved. */ private _onLoaderComplete; private _killLoaderSession; private _onAssetRename; private _onAssetConflictResolved; } //# sourceMappingURL=AssetLibraryBundle.d.ts.map