From a70433959b548df2315726963ddfcc579e0a3f87 Mon Sep 17 00:00:00 2001 From: Goh Jia Hao Date: Thu, 26 May 2016 22:50:15 +0800 Subject: [PATCH] Refactor to use ES6 imports for electron modules --- app/src/components/contextMenu/contextMenu.js | 3 +-- app/src/components/login/loginWindow.js | 3 +-- app/src/components/mainWindow/mainWindow.js | 3 +-- app/src/main.js | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/components/contextMenu/contextMenu.js b/app/src/components/contextMenu/contextMenu.js index 637d478..c555493 100644 --- a/app/src/components/contextMenu/contextMenu.js +++ b/app/src/components/contextMenu/contextMenu.js @@ -1,5 +1,4 @@ -import electron from 'electron'; -const {Menu, ipcMain, shell, BrowserWindow} = electron; +import {Menu, ipcMain, shell, BrowserWindow} from 'electron'; function initContextMenu(mainWindow) { ipcMain.on('contextMenuOpened', (event, targetHref) => { diff --git a/app/src/components/login/loginWindow.js b/app/src/components/login/loginWindow.js index 8de81b3..3427b01 100644 --- a/app/src/components/login/loginWindow.js +++ b/app/src/components/login/loginWindow.js @@ -1,6 +1,5 @@ -import electron from 'electron'; +import {BrowserWindow, ipcMain} from 'electron'; import path from 'path'; -const {BrowserWindow, ipcMain} = electron; function createLoginWindow(loginCallback) { var loginWindow = new BrowserWindow({ diff --git a/app/src/components/mainWindow/mainWindow.js b/app/src/components/mainWindow/mainWindow.js index 9819584..8e76255 100644 --- a/app/src/components/mainWindow/mainWindow.js +++ b/app/src/components/mainWindow/mainWindow.js @@ -1,12 +1,11 @@ import fs from 'fs'; import path from 'path'; -import electron from 'electron'; +import {BrowserWindow, shell, ipcMain, dialog} from 'electron'; import windowStateKeeper from 'electron-window-state'; import helpers from './../../helpers/helpers'; import createMenu from './../menu/menu'; import initContextMenu from './../contextMenu/contextMenu'; -const {BrowserWindow, shell, ipcMain, dialog} = electron; const {isOSX, linkIsInternal, getCssToInject} = helpers; const ZOOM_INTERVAL = 0.1; diff --git a/app/src/main.js b/app/src/main.js index 69540d4..271599a 100644 --- a/app/src/main.js +++ b/app/src/main.js @@ -1,13 +1,12 @@ import 'source-map-support/register'; import fs from 'fs'; import path from 'path'; -import electron from 'electron'; +import {app, ipcMain} from 'electron'; import createLoginWindow from './components/login/loginWindow'; import createMainWindow from './components/mainWindow/mainWindow'; import helpers from './helpers/helpers'; import inferFlash from './helpers/inferFlash'; -const {app, ipcMain} = electron; const {isOSX} = helpers; const APP_ARGS_FILE_PATH = path.join(__dirname, '..', 'nativefier.json');