diff --git a/src/components/gui/gui.jsx b/src/components/gui/gui.jsx index 36dbec0e2a0e77c04b9b9391c6d18637d238a1d3..4ef85e06f86da58832fde57ea875506c0772e9e4 100644 --- a/src/components/gui/gui.jsx +++ b/src/components/gui/gui.jsx @@ -11,6 +11,8 @@ const MenuBar = require('../menu-bar/menu-bar.jsx'); const Box = require('../box/box.jsx'); const styles = require('./gui.css'); +const Storage = require('../../lib/storage'); + const GUIComponent = props => { const { basePath, @@ -48,7 +50,7 @@ const GUIComponent = props => { <GreenFlag vm={vm} /> <StopAll vm={vm} /> </Box> - + <Box className={styles.stageWrapper} > <Stage shrink={0} @@ -74,6 +76,8 @@ GUIComponent.propTypes = { }; GUIComponent.defaultProps = { basePath: '/', - vm: new VM() + vm: new VM(), + storage: new Storage() }; +GUIComponent.defaultProps.vm.attachStorage(GUIComponent.defaultProps.storage); module.exports = GUIComponent; diff --git a/src/containers/stage.jsx b/src/containers/stage.jsx index 63d09b05c5ed99cded4153b0abfb167bc5fda729..3f693b78ca5d01ed2fdef4189fedafba49105a89 100644 --- a/src/containers/stage.jsx +++ b/src/containers/stage.jsx @@ -1,11 +1,10 @@ const bindAll = require('lodash.bindall'); -const AudioEngine = require('scratch-audio'); const React = require('react'); const Renderer = require('scratch-render'); +const AudioEngine = require('scratch-audio'); const VM = require('scratch-vm'); const StageComponent = require('../components/stage/stage.jsx'); -const Storage = require('../lib/storage'); class Stage extends React.Component { constructor (props) { @@ -33,12 +32,10 @@ class Stage extends React.Component { this.attachRectEvents(); this.attachMouseEvents(this.canvas); this.updateRect(); - this.audioEngine = new AudioEngine(); - this.props.vm.attachAudioEngine(this.audioEngine); this.renderer = new Renderer(this.canvas); this.props.vm.attachRenderer(this.renderer); - this.storage = new Storage(); - this.props.vm.attachStorage(this.storage); + this.audioEngine = new AudioEngine(); + this.props.vm.attachAudioEngine(this.audioEngine); } shouldComponentUpdate () { return false;