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
86f84d53
Commit
86f84d53
authored
Jan 11, 2017
by
Alex Beregszaszi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add config file API
parent
fae021f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
app.js
src/app.js
+2
-0
config.js
src/app/config.js
+28
-0
No files found.
src/app.js
View file @
86f84d53
...
...
@@ -11,6 +11,7 @@ var GistHandler = require('./app/gist-handler')
var
gistHandler
=
new
GistHandler
()
var
Storage
=
require
(
'./app/storage'
)
var
Config
=
require
(
'./app/config'
)
var
Editor
=
require
(
'./app/editor'
)
var
Renderer
=
require
(
'./app/renderer'
)
var
Compiler
=
require
(
'./app/compiler'
)
...
...
@@ -40,6 +41,7 @@ var run = function () {
var
self
=
this
this
.
event
=
new
EventManager
()
var
storage
=
new
Storage
()
var
config
=
new
Config
(
storage
)
function
loadFiles
(
files
)
{
for
(
var
f
in
files
)
{
...
...
src/app/config.js
0 → 100644
View file @
86f84d53
'use strict'
var
CONFIG_FILE
=
'.browser-solidity.json'
function
Config
(
storage
)
{
this
.
items
=
{}
// load on instantiation
var
config
=
storage
.
get
(
CONFIG_FILE
)
if
(
config
)
{
this
.
items
=
JSON
.
parse
(
config
)
}
this
.
exists
=
function
(
key
)
{
return
this
.
items
[
key
]
!==
undefined
}
this
.
get
=
function
(
key
)
{
return
this
.
items
[
key
]
}
this
.
set
=
function
(
key
,
content
)
{
this
.
items
[
key
]
=
content
storage
.
set
(
CONFIG_FILE
,
JSON
.
stringify
(
this
.
items
))
}
}
module
.
exports
=
Config
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