Skip to content
Snippets Groups Projects
Commit 4e38da17 authored by Christopher Willis-Ford's avatar Christopher Willis-Ford
Browse files

Add a hook for custom storage init

parent 4ab73a77
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@ import FontLoaderHOC from '../lib/font-loader-hoc.jsx';
import LocalizationHOC from '../lib/localization-hoc.jsx';
import ProjectFetcherHOC from '../lib/project-fetcher-hoc.jsx';
import ProjectSaverHOC from '../lib/project-saver-hoc.jsx';
import storage from '../lib/storage';
import vmListenerHOC from '../lib/vm-listener-hoc.jsx';
import vmManagerHOC from '../lib/vm-manager-hoc.jsx';
......@@ -45,6 +46,7 @@ const messages = defineMessages({
class GUI extends React.Component {
componentDidMount () {
this.setReduxTitle(this.props.projectTitle);
this.props.onStorageInit(storage);
}
componentDidUpdate (prevProps) {
if (this.props.projectId !== prevProps.projectId && this.props.projectId !== null) {
......@@ -75,6 +77,7 @@ class GUI extends React.Component {
hideIntro,
isError,
isShowingProject,
onStorageInit,
onUpdateProjectId,
onUpdateReduxProjectTitle,
projectHost,
......@@ -111,6 +114,7 @@ GUI.propTypes = {
isShowingProject: PropTypes.bool,
loadingStateVisible: PropTypes.bool,
onSeeCommunity: PropTypes.func,
onStorageInit: PropTypes.func,
onUpdateProjectId: PropTypes.func,
onUpdateProjectTitle: PropTypes.func,
onUpdateReduxProjectTitle: PropTypes.func,
......@@ -122,6 +126,7 @@ GUI.propTypes = {
};
GUI.defaultProps = {
onStorageInit: storageInstance => storageInstance.addOfficialScratchWebStores(),
onUpdateProjectId: () => {}
};
......
......@@ -10,6 +10,8 @@ class Storage extends ScratchStorage {
constructor () {
super();
this.cacheDefaultProject();
}
addOfficialScratchWebStores () {
this.addWebStore(
[this.AssetType.Project],
this.getProjectGetConfig.bind(this),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment