mirror of https://github.com/keeweb/keeweb.git
Fixed eslint
This commit is contained in:
parent
017c03a4e0
commit
ab243dda4d
|
@ -2,9 +2,9 @@
|
|||
|
||||
const bootstrap = () => {
|
||||
require('./bootstrap');
|
||||
}
|
||||
};
|
||||
|
||||
if(window.cordova) {
|
||||
if (window.cordova) {
|
||||
document.addEventListener('deviceready', bootstrap, false);
|
||||
} else {
|
||||
bootstrap();
|
||||
|
|
|
@ -6,7 +6,7 @@ const Logger = require('../util/logger');
|
|||
|
||||
const logger = new Logger('launcher');
|
||||
|
||||
let Launcher = {
|
||||
const Launcher = {
|
||||
name: 'electron',
|
||||
version: window.process.versions.electron,
|
||||
autoTypeSupported: true,
|
||||
|
@ -60,17 +60,16 @@ let Launcher = {
|
|||
try {
|
||||
this.req('fs').writeFileSync(path, new window.Buffer(data));
|
||||
callback();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
error(e);
|
||||
}
|
||||
|
||||
},
|
||||
readFile: function(path, callback, error) {
|
||||
try {
|
||||
const contents = this.req('fs').readFileSync(path);
|
||||
const data = typeof contents === 'string' ? contents : new Uint8Array(contents);
|
||||
callback(data);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
error(e);
|
||||
}
|
||||
},
|
||||
|
@ -78,7 +77,7 @@ let Launcher = {
|
|||
try {
|
||||
const exists = this.req('fs').existsSync(path);
|
||||
callback(exists);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
callback(false);
|
||||
}
|
||||
},
|
||||
|
@ -86,7 +85,7 @@ let Launcher = {
|
|||
try {
|
||||
this.req('fs').unlinkSync(path);
|
||||
callback();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
error(e);
|
||||
}
|
||||
},
|
||||
|
@ -94,7 +93,7 @@ let Launcher = {
|
|||
try {
|
||||
const stat = this.req('fs').statSync(path);
|
||||
callback(stat);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
error(e);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -6,7 +6,7 @@ const Logger = require('../util/logger');
|
|||
|
||||
const logger = new Logger('settings');
|
||||
|
||||
//TODO async
|
||||
// TODO async
|
||||
const SettingsStore = {
|
||||
|
||||
useFileStore: function() {
|
||||
|
|
|
@ -22,14 +22,12 @@ const StorageFileCache = StorageBase.extend({
|
|||
const path = Launcher.getUserDataPath('OfflineFiles');
|
||||
|
||||
Launcher.fileExists(path, exists => {
|
||||
|
||||
if (!exists) {
|
||||
Launcher.mkdir(path, () => {
|
||||
this.path = path;
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -71,7 +69,6 @@ const StorageFileCache = StorageBase.extend({
|
|||
callback(e, null);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -25,13 +25,11 @@ const StorageFile = StorageBase.extend({
|
|||
|
||||
Launcher.readFile(path, data => {
|
||||
Launcher.statFile(path, stat => {
|
||||
|
||||
const rev = stat.mtime.getTime().toString();
|
||||
this.logger.debug('Loaded', path, rev, this.logger.ts(ts));
|
||||
if (callback) {
|
||||
callback(null, data.buffer, { rev: rev });
|
||||
}
|
||||
|
||||
}, onError);
|
||||
}, onError);
|
||||
},
|
||||
|
@ -66,41 +64,31 @@ const StorageFile = StorageBase.extend({
|
|||
};
|
||||
|
||||
const write = () => {
|
||||
|
||||
Launcher.writeFile(path, data, () => {
|
||||
Launcher.statFile(path, stat => {
|
||||
|
||||
var newRev = stat.mtime.getTime().toString();
|
||||
const newRev = stat.mtime.getTime().toString();
|
||||
this.logger.debug('Saved', path, this.logger.ts(ts));
|
||||
if (callback) {
|
||||
callback(undefined, { rev: newRev });
|
||||
}
|
||||
|
||||
}, onError);
|
||||
}, onError);
|
||||
|
||||
};
|
||||
|
||||
if (rev) {
|
||||
|
||||
Launcher.statFile(path, stat => {
|
||||
|
||||
var fileRev = stat.mtime.getTime().toString();
|
||||
const fileRev = stat.mtime.getTime().toString();
|
||||
if (fileRev !== rev) {
|
||||
this.logger.debug('Save mtime differs', rev, fileRev);
|
||||
if (callback) {
|
||||
callback({ revConflict: true }, { rev: fileRev });
|
||||
}
|
||||
}
|
||||
|
||||
write();
|
||||
|
||||
}, onError);
|
||||
|
||||
} else {
|
||||
write();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
mkdir: function(path, callback) {
|
||||
|
|
Loading…
Reference in New Issue