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
b97b56f3
Commit
b97b56f3
authored
Feb 15, 2017
by
Alex Beregszaszi
Committed by
GitHub
Feb 15, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #426 from ethereum/cleanup
Cleanup storage.js
parents
e064f0d7
9424342c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
23 deletions
+14
-23
app.js
src/app.js
+3
-3
storage.js
src/app/storage.js
+11
-20
No files found.
src/app.js
View file @
b97b56f3
...
...
@@ -127,7 +127,7 @@ var run = function () {
if
(
typeof
resp
[
key
]
!==
'undefined'
&&
obj
[
key
]
!==
resp
[
key
]
&&
confirm
(
'Overwrite "'
+
key
+
'"? Click Ok to overwrite local file with file from cloud. Cancel will push your local file to the cloud.'
))
{
console
.
log
(
'Overwriting'
,
key
)
files
.
set
(
key
,
resp
[
key
])
updateFile
s
()
refreshTab
s
()
}
else
{
console
.
log
(
'add to obj'
,
obj
,
key
)
obj
[
key
]
=
files
.
get
(
key
)
...
...
@@ -296,7 +296,7 @@ var run = function () {
return
false
})
editor
.
event
.
register
(
'sessionSwitched'
,
updateFile
s
)
editor
.
event
.
register
(
'sessionSwitched'
,
refreshTab
s
)
function
switchToFile
(
file
)
{
currentFile
=
file
...
...
@@ -318,7 +318,7 @@ var run = function () {
switchToNextFile
()
// Synchronise tab list with file names known to the editor
function
updateFile
s
()
{
function
refreshTab
s
()
{
var
$filesEl
=
$
(
'#files'
)
var
fileNames
=
Object
.
keys
(
files
.
list
())
...
...
src/app/storage.js
View file @
b97b56f3
...
...
@@ -18,19 +18,6 @@ function Storage () {
return
true
}
function
safeKeys
()
{
// NOTE: this is a workaround for some browsers
return
Object
.
keys
(
window
.
localStorage
).
filter
(
function
(
item
)
{
return
item
!==
null
&&
item
!==
undefined
})
}
this
.
keys
=
function
()
{
return
safeKeys
()
// filter any names not including sol:
.
filter
(
function
(
item
)
{
return
item
.
indexOf
(
'sol:'
,
0
)
===
0
})
// remove sol: from filename
.
map
(
function
(
item
)
{
return
item
.
replace
(
/^sol:/
,
''
)
})
}
this
.
remove
=
function
(
name
)
{
window
.
localStorage
.
removeItem
(
'sol:'
+
name
)
return
true
...
...
@@ -45,13 +32,17 @@ function Storage () {
return
true
}
this
.
loadFile
=
function
(
filename
,
content
)
{
if
(
this
.
exists
(
filename
)
&&
this
.
get
(
filename
)
!==
content
)
{
var
count
=
''
while
(
this
.
exists
(
filename
+
count
))
count
=
count
-
1
this
.
rename
(
filename
,
filename
+
count
)
}
this
.
set
(
filename
,
content
)
function
safeKeys
()
{
// NOTE: this is a workaround for some browsers
return
Object
.
keys
(
window
.
localStorage
).
filter
(
function
(
item
)
{
return
item
!==
null
&&
item
!==
undefined
})
}
this
.
keys
=
function
()
{
return
safeKeys
()
// filter any names not including sol:
.
filter
(
function
(
item
)
{
return
item
.
indexOf
(
'sol:'
,
0
)
===
0
})
// remove sol: from filename
.
map
(
function
(
item
)
{
return
item
.
replace
(
/^sol:/
,
''
)
})
}
// on startup, upgrade the old storage layout
...
...
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