Get Asset and AssetType from storage instance
This commit is contained in:
1 parent
d20238ae73
commit
a0f7d75fdc
2 files changed
+3
-5
No files matched your search
@@ -2,7 +2,6 @@ const bindAll = require('lodash.bindall');
|
||||
const React = require('react');
|
||||
const VM = require('scratch-vm');
|
||||
const AudioEngine = require('scratch-audio');
|
||||
const AssetType = require('scratch-storage').AssetType;
|
||||
const LibaryComponent = require('../components/library/library.jsx');
|
||||
|
||||
const soundIcon = require('../components/asset-panel/icon--sound.svg');
|
||||
@@ -26,7 +25,7 @@ class SoundLibrary extends React.Component {
|
||||
const idParts = md5ext.split('.');
|
||||
const md5 = idParts[0];
|
||||
const vm = this.props.vm;
|
||||
vm.runtime.storage.load(AssetType.Sound, md5).then(soundAsset => {
|
||||
vm.runtime.storage.load(vm.runtime.storage.AssetType.Sound, md5).then(soundAsset => {
|
||||
const sound = {
|
||||
md5: md5ext,
|
||||
name: soundItem.name,
|
||||
|
||||
+2
-3
@@ -1,5 +1,4 @@
|
||||
const ScratchStorage = require('scratch-storage');
|
||||
const AssetType = ScratchStorage.AssetType;
|
||||
|
||||
const PROJECT_SERVER = 'https://cdn.projects.scratch.mit.edu';
|
||||
const ASSET_SERVER = 'https://cdn.assets.scratch.mit.edu';
|
||||
@@ -12,7 +11,7 @@ class Storage extends ScratchStorage {
|
||||
constructor () {
|
||||
super();
|
||||
this.addWebSource(
|
||||
[AssetType.Project],
|
||||
[this.AssetType.Project],
|
||||
projectAsset => {
|
||||
const [projectId, revision] = projectAsset.assetId.split('.');
|
||||
return revision ?
|
||||
@@ -21,7 +20,7 @@ class Storage extends ScratchStorage {
|
||||
}
|
||||
);
|
||||
this.addWebSource(
|
||||
[AssetType.ImageVector, AssetType.ImageBitmap, AssetType.Sound],
|
||||
[this.AssetType.ImageVector, this.AssetType.ImageBitmap, this.AssetType.Sound],
|
||||
asset => `${ASSET_SERVER}/internalapi/asset/${asset.assetId}.${asset.assetType.runtimeFormat}/get/`
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user