Merge pull request from rschamp/feature/cache-api

Expose builtinHelper.cache to storage API
This commit is contained in:
Ray Schamp 2017-11-02 15:47:57 -04:00 committed by GitHub
commit 77a7dacfdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,6 +68,18 @@ class ScratchStorage {
return this.builtinHelper.get(assetId);
}
/**
* Cache an asset for future lookups by ID.
* @param {AssetType} assetType - The type of the asset to cache.
* @param {DataFormat} dataFormat - The dataFormat of the data for the cached asset.
* @param {Buffer} data - The data for the cached asset.
* @param {string} id - The id for the cached asset.
* @returns {string} The calculated id of the cached asset, or the supplied id if the asset is mutable.
*/
cache (assetType, dataFormat, data, id) {
return this.builtinHelper.cache(assetType, dataFormat, data, id);
}
/**
* Register a web-based source for assets. Sources will be checked in order of registration.
* @param {Array.<AssetType>} types - The types of asset provided by this source.