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
7a9b1695
Commit
7a9b1695
authored
Jun 24, 2016
by
chriseth
Committed by
GitHub
Jun 24, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #77 from redsquirrel/encapsulate-cache-file-prefix
Encapsulating 'Cache File Prefix'
parents
b1e4e018
861deadf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
editor.js
src/app/editor.js
+2
-2
storage-handler.js
src/app/storage-handler.js
+1
-1
utils.js
src/app/utils.js
+5
-1
No files found.
src/app/editor.js
View file @
7a9b1695
...
@@ -6,7 +6,7 @@ var ace = require('brace');
...
@@ -6,7 +6,7 @@ var ace = require('brace');
require
(
'../mode-solidity.js'
);
require
(
'../mode-solidity.js'
);
function
Editor
(
loadingFromGist
)
{
function
Editor
(
loadingFromGist
)
{
var
SOL_CACHE_UNTITLED
=
utils
.
getCacheFilePrefix
()
+
'Untitled'
;
var
SOL_CACHE_UNTITLED
=
utils
.
fileKey
(
'Untitled'
)
;
var
SOL_CACHE_FILE
=
null
;
var
SOL_CACHE_FILE
=
null
;
var
editor
=
ace
.
edit
(
'input'
);
var
editor
=
ace
.
edit
(
'input'
);
...
@@ -70,7 +70,7 @@ function Editor (loadingFromGist) {
...
@@ -70,7 +70,7 @@ function Editor (loadingFromGist) {
function
getFiles
()
{
function
getFiles
()
{
var
files
=
[];
var
files
=
[];
for
(
var
f
in
window
.
localStorage
)
{
for
(
var
f
in
window
.
localStorage
)
{
if
(
f
.
indexOf
(
utils
.
getCacheFilePrefix
(),
0
)
===
0
)
{
if
(
utils
.
isCachedFile
(
f
)
)
{
files
.
push
(
f
);
files
.
push
(
f
);
if
(
!
sessions
[
f
])
sessions
[
f
]
=
newEditorSession
(
f
);
if
(
!
sessions
[
f
])
sessions
[
f
]
=
newEditorSession
(
f
);
}
}
...
...
src/app/storage-handler.js
View file @
7a9b1695
...
@@ -35,7 +35,7 @@ function StorageHandler (updateFiles) {
...
@@ -35,7 +35,7 @@ function StorageHandler (updateFiles) {
for
(
var
y
in
window
.
localStorage
)
{
for
(
var
y
in
window
.
localStorage
)
{
console
.
log
(
'checking'
,
y
);
console
.
log
(
'checking'
,
y
);
obj
[
y
]
=
window
.
localStorage
.
getItem
(
y
);
obj
[
y
]
=
window
.
localStorage
.
getItem
(
y
);
if
(
y
.
indexOf
(
utils
.
getCacheFilePrefix
())
!==
0
)
{
if
(
!
utils
.
isCachedFile
(
y
)
)
{
continue
;
continue
;
}
}
count
++
;
count
++
;
...
...
src/app/utils.js
View file @
7a9b1695
...
@@ -4,6 +4,10 @@ function getCacheFilePrefix () {
...
@@ -4,6 +4,10 @@ function getCacheFilePrefix () {
return
SOL_CACHE_FILE_PREFIX
;
return
SOL_CACHE_FILE_PREFIX
;
}
}
function
isCachedFile
(
name
)
{
return
name
.
indexOf
(
getCacheFilePrefix
(),
0
)
===
0
;
}
function
fileKey
(
name
)
{
function
fileKey
(
name
)
{
return
getCacheFilePrefix
()
+
name
;
return
getCacheFilePrefix
()
+
name
;
}
}
...
@@ -17,7 +21,7 @@ function errortype (message) {
...
@@ -17,7 +21,7 @@ function errortype (message) {
}
}
module
.
exports
=
{
module
.
exports
=
{
getCacheFilePrefix
:
getCacheFilePrefix
,
isCachedFile
:
isCachedFile
,
fileKey
:
fileKey
,
fileKey
:
fileKey
,
fileNameFromKey
:
fileNameFromKey
,
fileNameFromKey
:
fileNameFromKey
,
errortype
:
errortype
errortype
:
errortype
...
...
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