Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
62a43de7
Commit
62a43de7
authored
Jan 06, 2020
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
load workspace from localstorage or queryparams
parent
8dcf0057
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
6 deletions
+42
-6
app.js
src/app.js
+1
-1
remixAppManager.js
src/remixAppManager.js
+41
-5
No files found.
src/app.js
View file @
62a43de7
...
@@ -208,7 +208,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...
@@ -208,7 +208,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// APP_MANAGER
// APP_MANAGER
const
appManager
=
new
RemixAppManager
({})
const
appManager
=
new
RemixAppManager
({})
const
workspace
=
JSON
.
parse
(
localStorage
.
getItem
(
'workspace'
)
)
const
workspace
=
appManager
.
pluginLoader
.
get
(
)
// SERVICES
// SERVICES
// ----------------- import content servive ----------------------------
// ----------------- import content servive ----------------------------
...
...
src/remixAppManager.js
View file @
62a43de7
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
{
PluginEngine
,
IframePlugin
}
from
'@remixproject/engine'
import
{
PluginEngine
,
IframePlugin
}
from
'@remixproject/engine'
import
{
EventEmitter
}
from
'events'
import
{
EventEmitter
}
from
'events'
import
{
PermissionHandler
}
from
'./app/ui/persmission-handler'
import
{
PermissionHandler
}
from
'./app/ui/persmission-handler'
import
QueryParams
from
'./lib/query-params'
const
requiredModules
=
[
// services + layout views + system views
const
requiredModules
=
[
// services + layout views + system views
'compilerArtefacts'
,
'compilerMetadata'
,
'contextualListener'
,
'editor'
,
'offsetToLineColumnConverter'
,
'network'
,
'theme'
,
'fileManager'
,
'contentImport'
,
'compilerArtefacts'
,
'compilerMetadata'
,
'contextualListener'
,
'editor'
,
'offsetToLineColumnConverter'
,
'network'
,
'theme'
,
'fileManager'
,
'contentImport'
,
...
@@ -19,15 +20,13 @@ export class RemixAppManager extends PluginEngine {
...
@@ -19,15 +20,13 @@ export class RemixAppManager extends PluginEngine {
constructor
(
plugins
)
{
constructor
(
plugins
)
{
super
(
plugins
,
settings
)
super
(
plugins
,
settings
)
this
.
event
=
new
EventEmitter
()
this
.
event
=
new
EventEmitter
()
this
.
donotAutoReload
=
[
'remixd'
]
// that would be a bad practice to force loading some plugins at page load.
this
.
registered
=
{}
this
.
registered
=
{}
this
.
pluginsDirectory
=
'https://raw.githubusercontent.com/ethereum/remix-plugins-directory/master/build/profile.json'
this
.
pluginsDirectory
=
'https://raw.githubusercontent.com/ethereum/remix-plugins-directory/master/build/profile.json'
this
.
pluginLoader
=
new
PluginLoader
()
}
}
onActivated
(
plugin
)
{
onActivated
(
plugin
)
{
if
(
!
this
.
donotAutoReload
.
includes
(
plugin
.
name
))
{
this
.
pluginLoader
.
set
(
plugin
,
this
.
actives
)
localStorage
.
setItem
(
'workspace'
,
JSON
.
stringify
(
this
.
actives
))
}
this
.
event
.
emit
(
'activate'
,
plugin
.
name
)
this
.
event
.
emit
(
'activate'
,
plugin
.
name
)
}
}
...
@@ -46,7 +45,7 @@ export class RemixAppManager extends PluginEngine {
...
@@ -46,7 +45,7 @@ export class RemixAppManager extends PluginEngine {
}
}
onDeactivated
(
plugin
)
{
onDeactivated
(
plugin
)
{
localStorage
.
setItem
(
'workspace'
,
JSON
.
stringify
(
this
.
actives
)
)
this
.
pluginLoader
.
set
(
plugin
,
this
.
actives
)
this
.
event
.
emit
(
'deactivate'
,
plugin
.
name
)
this
.
event
.
emit
(
'deactivate'
,
plugin
.
name
)
}
}
...
@@ -232,3 +231,40 @@ export class RemixAppManager extends PluginEngine {
...
@@ -232,3 +231,40 @@ export class RemixAppManager extends PluginEngine {
]
]
}
}
}
}
class
PluginLoader
{
constructor
()
{
const
queryParams
=
new
QueryParams
()
this
.
donotAutoReload
=
[
'remixd'
]
// that would be a bad practice to force loading some plugins at page load.
this
.
loaders
=
{}
this
.
loaders
[
'localStorage'
]
=
{
set
:
(
plugin
,
actives
)
=>
{
if
(
!
this
.
donotAutoReload
.
includes
(
plugin
.
name
))
{
localStorage
.
setItem
(
'workspace'
,
JSON
.
stringify
(
actives
))
}
},
get
:
()
=>
{
return
JSON
.
parse
(
localStorage
.
getItem
(
'workspace'
))
}
}
this
.
loaders
[
'queryParams'
]
=
{
set
:
()
=>
{},
get
:
()
=>
{
let
plugins
=
queryParams
.
get
()[
'plugins'
]
if
(
!
plugins
)
return
[]
return
plugins
.
split
(
','
)
}
}
this
.
current
=
queryParams
.
get
()[
'plugins'
]
?
'queryParams'
:
'localStorage'
}
set
(
plugin
,
actives
)
{
this
.
loaders
[
this
.
current
].
set
(
plugin
,
actives
)
}
get
()
{
return
this
.
loaders
[
this
.
current
].
get
()
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment