Export new GUI

scratch-gui exports `index.js` instead of just GUI container.
This commit is contained in:
chrisgarrity committed 2018-05-21 16:54:19 -04:00
1 parent 5e51235ffa
commit a3392bcb8d
3 files changed
+32 -3

No files matched your search

+3 -1
View File
@@ -24,12 +24,13 @@ class GUI extends React.Component {
constructor (props) {
super(props);
this.state = {
loading: true,
loading: !props.vm.initialized,
loadingError: false,
errorMessage: ''
};
}
componentDidMount () {
if (this.props.vm.initialized) return;
this.audioEngine = new AudioEngine();
this.props.vm.attachAudioEngine(this.audioEngine);
this.props.vm.loadProject(this.props.projectData)
@@ -44,6 +45,7 @@ class GUI extends React.Component {
// error page gets rendered if project failed to load
this.setState({loadingError: true, errorMessage: e});
});
this.props.vm.initialized = true;
}
componentWillReceiveProps (nextProps) {
if (this.props.projectData !== nextProps.projectData) {
+28
View File
@@ -0,0 +1,28 @@
import GUI from './containers/gui.jsx';
import GuiReducer, {guiInitialState, initFullScreen, initPlayer} from './reducers/gui';
import {ScratchPaintReducer} from 'scratch-paint';
import IntlReducer from './reducers/intl';
import {setFullScreen, setPlayer} from './reducers/mode';
import {setAppElement} from 'react-modal';
import {applyMiddleware, compose} from 'redux';
import throttle from 'redux-throttle';
const guiReducers = {
intl: IntlReducer,
scratchGui: GuiReducer,
scratchPaint: ScratchPaintReducer
};
const guiMiddleware = compose(applyMiddleware(throttle(300, {leading: true, trailing: true})));
export {
GUI as default,
setAppElement,
guiReducers,
guiInitialState,
guiMiddleware,
initPlayer,
initFullScreen,
setFullScreen,
setPlayer
};
+1 -2
View File
@@ -166,7 +166,7 @@ module.exports = [
defaultsDeep({}, base, {
target: 'web',
entry: {
'scratch-gui': './src/containers/gui.jsx'
'scratch-gui': './src/index.js'
},
output: {
libraryTarget: 'umd',
@@ -179,7 +179,6 @@ module.exports = [
module: {
rules: base.module.rules.concat([
{
test: /\.(svg|png|wav|gif|jpg)$/,
loader: 'file-loader',
options: {