mirror of
https://github.com/scratchfoundation/scratch-storage.git
synced 2025-07-11 22:03:57 -04:00
Merge pull request #25 from rschamp/feature/cache-api
Expose builtinHelper.cache to storage API
This commit is contained in:
commit
77a7dacfdb
1 changed files with 12 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue