Skip to content

Commit

Permalink
chore(electron): update electron template to not use injectCapacitor (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jun 17, 2019
1 parent e3cf60e commit 5d244a1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions electron-template/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const { app, BrowserWindow, Menu } = require('electron');
const isDevMode = require('electron-is-dev');
const { injectCapacitor, CapacitorSplashScreen } = require('@capacitor/electron');
const { CapacitorSplashScreen } = require('@capacitor/electron');

const path = require('path');
global.__basedir = path.resolve(__dirname);

// Place holders for our windows so they don't get garbage collected.
let mainWindow = null;
Expand Down Expand Up @@ -35,6 +34,10 @@ async function createWindow () {
height: 920,
width: 1600,
show: false,
webPreferences: {
nodeIntegration: true,
preload: path.join(__dirname, 'node_modules', '@capacitor', 'electron', 'dist', 'electron-bridge.js')
}
});

if (isDevMode) {
Expand All @@ -46,9 +49,9 @@ async function createWindow () {

if(useSplashScreen) {
splashScreen = new CapacitorSplashScreen(mainWindow);
splashScreen.init();
splashScreen.init(false);
} else {
mainWindow.loadURL(await injectCapacitor(`file://${__dirname}/app/index.html`), {baseURLForDataURL: `file://${__dirname}/app/`});
mainWindow.loadURL(`file://${__dirname}/app/index.html`);
mainWindow.webContents.on('dom-ready', () => {
mainWindow.show();
});
Expand Down

0 comments on commit 5d244a1

Please sign in to comment.