|
@@ -2,6 +2,8 @@
|
|
|
|
|
|
const {EventEmitter} = require('events')
|
|
|
const electron = require('electron')
|
|
|
+const path = require('path')
|
|
|
+const url = require('url')
|
|
|
const {app, ipcMain, session, NavigationController} = electron
|
|
|
|
|
|
// session is not used here, the purpose is to make sure session is initalized
|
|
@@ -243,6 +245,17 @@ WebContents.prototype.getZoomLevel = function (callback) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+WebContents.prototype.loadFile = function (filePath) {
|
|
|
+ if (typeof filePath !== 'string') {
|
|
|
+ throw new Error('Must pass filePath as a string')
|
|
|
+ }
|
|
|
+ return this.loadURL(url.format({
|
|
|
+ protocol: 'file',
|
|
|
+ slashes: true,
|
|
|
+ pathname: path.resolve(app.getAppPath(), filePath)
|
|
|
+ }))
|
|
|
+}
|
|
|
+
|
|
|
WebContents.prototype.getZoomFactor = function (callback) {
|
|
|
if (typeof callback !== 'function') {
|
|
|
throw new Error('Must pass function as an argument')
|