From d2b40bb5a31141da576b8bd97bd1bc340606edb4 Mon Sep 17 00:00:00 2001 From: GarboMuffin Date: Fri, 6 Jan 2023 18:34:05 -0600 Subject: [PATCH] Clean up our scratch-storage subclass - Remove shadowing of `asset` - Replace deprecated `ScratchStorage.AssetType` - Rename the class to something more descriptive --- src/scaffolding/storage.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/scaffolding/storage.js b/src/scaffolding/storage.js index d3cfe72..1b1bde7 100644 --- a/src/scaffolding/storage.js +++ b/src/scaffolding/storage.js @@ -1,6 +1,6 @@ import ScratchStorage from 'scratch-storage'; -class Storage extends ScratchStorage { +class StorageWithProgress extends ScratchStorage { constructor () { super(); @@ -16,22 +16,22 @@ class Storage extends ScratchStorage { load (assetType, asset, assetFormat) { const isAsset = ( - assetType === ScratchStorage.AssetType.ImageBitmap || - assetType === ScratchStorage.AssetType.ImageVector || - assetType === ScratchStorage.AssetType.Sound + assetType === this.AssetType.ImageBitmap || + assetType === this.AssetType.ImageVector || + assetType === this.AssetType.Sound ); if (isAsset) { this._totalAssets++; this._updateProgress(); return super.load(assetType, asset, assetFormat) - .then((asset) => { + .then((loadedAsset) => { this._loadedAssets++; this._updateProgress(); - return asset; + return loadedAsset; }); } return super.load(assetType, asset, assetFormat); } } -export default Storage; +export default StorageWithProgress;