Add workspaces in localstorage

pull/1/head
Grandschtroumpf 5 years ago committed by François
parent 50b9b73aa4
commit 8cd5b7d1cb
  1. 8
      src/app.js
  2. 2
      src/lib/store.js
  3. 1
      src/remixAppManager.js

@ -264,6 +264,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}
let appStore = new EntityStore('module', 'name')
// Get workspace before creating the App Manager
const workspace = JSON.parse(localStorage.getItem('workspace'))
const appManager = new RemixAppManager(appStore)
registry.put({api: appManager, name: 'appmanager'})
@ -439,6 +441,12 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...appManager.plugins()
])
// Set workspace after initial activation
if (Array.isArray(workspace)) {
console.log(workspace)
appManager.activateMany(workspace)
}
framingService.start(appStore, sidePanel, verticalIcons, mainPanel, this._components.resizeFeature)
// The event listener needs to be registered as early as possible, because the

@ -194,6 +194,7 @@ export class EntityStore extends Store {
* @param {((string|number))} ids An id or a list of id to activate
*/
activate (id) {
if (this.actives.includes(id)) return
this.state.actives.push(id)
this.event.emit('activate', id)
}
@ -203,6 +204,7 @@ export class EntityStore extends Store {
* @param {(string|number))} ids An id or a list of id to deactivate
*/
deactivate (id) {
if (!this.actives.includes(id)) return
this.state.actives.splice(this.state.actives.indexOf(id), 1)
this.event.emit('deactivate', id)
}

@ -41,6 +41,7 @@ export class RemixAppManager extends AppManagerApi {
if (!isActive) {
this.removeHiddenServices(api)
}
localStorage.setItem('workspace', JSON.stringify(this.store.actives))
}
getEntity (apiName) {

Loading…
Cancel
Save