1.0.0 • Published 9 years ago
electron-run-in-browser v1.0.0
electron-run-in-browser
Run some js in a BrowserWindow and get the result.
Usage
runInBrowser(win, func, cb)
win:BrowserWindowinstance.func: function. Serialized withtoStringso it needs to be self-contained.cb: callback function, called with (err, result)
Example
const BrowserWindow = require('electron').BrowserWindow
const runInBrowser = require('electron-run-in-browser')
const win = new BrowserWindow()
win.webContents.on('dom-ready', function (e) {
runInBrowser(win, getDocumentTitle, function (err, title) {
console.log('title:', title)
})
})
function getDocumentTitle () {
return document.title
}License
MIT
1.0.0
9 years ago