Skip to content

Commit

Permalink
chore(example): update electron project to work with latest capacitor (
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Feb 25, 2020
1 parent e1a00bd commit 09fff9b
Show file tree
Hide file tree
Showing 3 changed files with 405 additions and 891 deletions.
12 changes: 9 additions & 3 deletions example/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,26 @@ const BrowserWindow = electron.BrowserWindow

const path = require('path')
const url = require('url')
const { injectCapacitor } = require('@capacitor/electron');

let mainWindow

async function createWindow () {

mainWindow = new BrowserWindow({width: 800, height: 600})
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
preload: path.join(__dirname, 'node_modules', '@capacitor', 'electron', 'dist', 'electron-bridge.js')
}
})
/*mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'www/index.html'),
protocol: 'file:',
slashes: true
}))*/

mainWindow.loadURL(await injectCapacitor(`file://${__dirname}/www/index.html`), {baseURLForDataURL: `file://${__dirname}/www/`});
mainWindow.loadURL(`file://${__dirname}/www/index.html`);
mainWindow.webContents.openDevTools()


Expand Down
Loading

0 comments on commit 09fff9b

Please sign in to comment.