Fix localstorage crashing first launch

This commit is contained in:
Gregory Schier 2016-08-03 09:35:43 -07:00
parent 3c70480b19
commit 4dc5564992
2 changed files with 4 additions and 3 deletions

View File

@ -11,8 +11,6 @@ const appVersion = require('./app.json').version;
const {app, dialog, ipcMain, autoUpdater, Menu, BrowserWindow, webContents} = electron; const {app, dialog, ipcMain, autoUpdater, Menu, BrowserWindow, webContents} = electron;
const {LocalStorage} = require('node-localstorage'); const {LocalStorage} = require('node-localstorage');
const localStorage = new LocalStorage(path.join(app.getPath('userData'), 'localStorage'));
const IS_DEV = process.env.NODE_ENV === 'development'; const IS_DEV = process.env.NODE_ENV === 'development';
const IS_MAC = process.platform === 'darwin'; const IS_MAC = process.platform === 'darwin';
const IS_WIN = process.platform === 'win32'; const IS_WIN = process.platform === 'win32';
@ -25,6 +23,7 @@ const UPDATE_URLS = {
}; };
let mainWindow = null; let mainWindow = null;
let localStorage = null;
// Enable this for CSS grid layout :) // Enable this for CSS grid layout :)
app.commandLine.appendSwitch('enable-experimental-web-platform-features'); app.commandLine.appendSwitch('enable-experimental-web-platform-features');
@ -119,6 +118,8 @@ app.on('window-all-closed', () => {
}); });
app.on('ready', () => { app.on('ready', () => {
localStorage = new LocalStorage(path.join(app.getPath('userData'), 'localStorage'));
const zoomFactor = getZoomFactor(); const zoomFactor = getZoomFactor();
const bounds = getBounds(); const bounds = getBounds();
const {x, y, width, height} = bounds; const {x, y, width, height} = bounds;

View File

@ -1,7 +1,7 @@
{ {
"private": true, "private": true,
"name": "insomnia", "name": "insomnia",
"version": "3.0.15", "version": "3.0.16",
"productName": "Insomnia", "productName": "Insomnia",
"longName": "Insomnia HTTP Client", "longName": "Insomnia HTTP Client",
"description": "The best REST API Client", "description": "The best REST API Client",