|
|
@ -3,7 +3,7 @@ |
|
|
|
var CONFIG_FILE = '.remix.config' |
|
|
|
var CONFIG_FILE = '.remix.config' |
|
|
|
const EventEmitter = require('events') |
|
|
|
const EventEmitter = require('events') |
|
|
|
|
|
|
|
|
|
|
|
function Config (storage) { |
|
|
|
function Config(storage) { |
|
|
|
this.items = {} |
|
|
|
this.items = {} |
|
|
|
this.unpersistedItems = {} |
|
|
|
this.unpersistedItems = {} |
|
|
|
this.events = new EventEmitter() |
|
|
|
this.events = new EventEmitter() |
|
|
@ -15,7 +15,7 @@ function Config (storage) { |
|
|
|
this.items = JSON.parse(config) |
|
|
|
this.items = JSON.parse(config) |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (exception) { |
|
|
|
} catch (exception) { |
|
|
|
/* Do nothing. */
|
|
|
|
/* Do nothing. */ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.exists = function (key) { |
|
|
|
this.exists = function (key) { |
|
|
@ -30,9 +30,10 @@ function Config (storage) { |
|
|
|
this.items[key] = content |
|
|
|
this.items[key] = content |
|
|
|
try { |
|
|
|
try { |
|
|
|
storage.set(CONFIG_FILE, JSON.stringify(this.items)) |
|
|
|
storage.set(CONFIG_FILE, JSON.stringify(this.items)) |
|
|
|
|
|
|
|
this.events.emit('configChanged', { key, content }) |
|
|
|
this.events.emit(key + '_changed', content) |
|
|
|
this.events.emit(key + '_changed', content) |
|
|
|
} catch (exception) { |
|
|
|
} catch (exception) { |
|
|
|
/* Do nothing. */
|
|
|
|
/* Do nothing. */ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|