import Check from "../Core/Check.js"; import defined from "../Core/defined.js"; import destroyObject from "../Core/destroyObject.js"; import DeveloperError from "../Core/DeveloperError.js"; import RuntimeError from "../Core/RuntimeError.js"; /** * A cache resource. *
* This type describes an interface and is not intended to be instantiated directly. *
* * @alias ResourceLoader * @constructor * * @see ResourceCache * * @private */ function ResourceLoader() {} Object.defineProperties(ResourceLoader.prototype, { /** * The cache key of the resource. * * @memberof ResourceLoader.prototype * * @type {string} * @readonly * @private */ cacheKey: { // eslint-disable-next-line getter-return get: function () { DeveloperError.throwInstantiationError(); }, }, }); /** * Loads the resource. * @returns {PromiseisDestroyed
will result in a {@link DeveloperError} exception.
*
* @returns {boolean} true
if this object was destroyed; otherwise, false
.
*
* @see ResourceLoader#destroy
* @private
*/
ResourceLoader.prototype.isDestroyed = function () {
return false;
};
/**
* Destroys the loaded resource.
* isDestroyed
will result in a {@link DeveloperError} exception. Therefore,
* assign the return value (undefined
) to the object as done in the example.
*
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
*
* @example
* resourceLoader = resourceLoader && resourceLoader.destroy();
*
* @see ResourceLoader#isDestroyed
* @private
*/
ResourceLoader.prototype.destroy = function () {
this.unload();
return destroyObject(this);
};
export default ResourceLoader;