Created
September 25, 2017 20:02
-
-
Save mallendeo/64866601771e03835958e244a95de095 to your computer and use it in GitHub Desktop.
Electron BrowserWindow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// const { ipcRenderer } = require('electron') | |
document.addEventListener('DOMContentLoaded', () => { | |
console.log('DOM Ready!') | |
}) | |
console.log('Script Injected!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import electron from 'electron' | |
import path from 'path' | |
// const { BrowserWindow } = electron.remote | |
const { BrowserWindow } = electron | |
//const filePath = path.join(__static, '/inject.js') | |
const filePath = path.join(__dirname, '/inject.js') | |
let win = new BrowserWindow({ | |
webPreferences: { | |
nodeIntegration: false, | |
webSecurity: true, | |
sandbox: true, | |
preload: filePath | |
}, | |
width: 800, | |
height: 600 | |
}) | |
win.loadURL('https://poloniex.com/login') | |
const contents = win.webContents | |
const { session } = contents | |
contents.on('did-navigate', event => { | |
console.log({ event }) | |
}) | |
contents.on('did-navigate-in-page', event => { | |
console.log('in-page', { event }) | |
}) | |
win.on('closed', () => { | |
session.clearStorageData() | |
win = null | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment