feat: add options to webContents.loadFile (#14515)
This commit is contained in:
parent
7a766e82f9
commit
58577bd431
8 changed files with 31 additions and 29 deletions
|
@ -243,14 +243,19 @@ WebContents.prototype.getZoomLevel = function (callback) {
|
|||
})
|
||||
}
|
||||
|
||||
WebContents.prototype.loadFile = function (filePath) {
|
||||
WebContents.prototype.loadFile = function (filePath, options = {}) {
|
||||
if (typeof filePath !== 'string') {
|
||||
throw new Error('Must pass filePath as a string')
|
||||
}
|
||||
const {query, search, hash} = options
|
||||
|
||||
return this.loadURL(url.format({
|
||||
protocol: 'file',
|
||||
slashes: true,
|
||||
pathname: path.resolve(app.getAppPath(), filePath)
|
||||
pathname: path.resolve(app.getAppPath(), filePath),
|
||||
query,
|
||||
search,
|
||||
hash
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue