Show "Saving..." for 0.5 seconds and show error if it occurred

This commit is contained in:
Yuya Ochiai
2017-02-16 21:55:44 +09:00
parent 949db4ffae
commit 8acd7b99e7
4 changed files with 78 additions and 40 deletions

View File

@@ -67,6 +67,14 @@ module.exports = {
return config;
},
writeFile(configFile, config, callback) {
if (config.version !== settingsVersion) {
throw new Error('version ' + config.version + ' is not equal to ' + settingsVersion);
}
var data = JSON.stringify(config, null, ' ');
fs.writeFile(configFile, data, 'utf8', callback);
},
writeFileSync(configFile, config) {
if (config.version !== settingsVersion) {
throw new Error('version ' + config.version + ' is not equal to ' + settingsVersion);