move storage defaults out to app

This commit is contained in:
Kyle Spearrin 2018-04-26 16:17:11 -04:00
parent 35039fdae2
commit 12533dd951
1 changed files with 6 additions and 5 deletions

View File

@ -1,20 +1,21 @@
import { StorageService } from '../../abstractions/storage.service';
import { ConstantsService } from '../../services/constants.service';
// tslint:disable-next-line
const Store = require('electron-store');
export class ElectronStorageService implements StorageService {
private store: any;
constructor() {
constructor(defaults?: any) {
const storeConfig: any = {
defaults: {} as any,
name: 'data',
};
// Default lock options to "on restart".
storeConfig.defaults[ConstantsService.lockOptionKey] = -1;
if (defaults != null) {
storeConfig.defaults = Object.assign({}, storeConfig.defaults, defaults);
}
this.store = new Store(storeConfig);
}