Support background.page in extension manifest
This commit is contained in:
parent
511dceda4e
commit
76f4bd01eb
1 changed files with 9 additions and 4 deletions
|
@ -72,10 +72,15 @@ const backgroundPages = {}
|
||||||
const startBackgroundPages = function (manifest) {
|
const startBackgroundPages = function (manifest) {
|
||||||
if (backgroundPages[manifest.extensionId] || !manifest.background) return
|
if (backgroundPages[manifest.extensionId] || !manifest.background) return
|
||||||
|
|
||||||
const scripts = manifest.background.scripts.map((name) => {
|
let html
|
||||||
return `<script src="${name}"></script>`
|
if (manifest.background.page) {
|
||||||
}).join('')
|
html = fs.readFileSync(path.join(manifest.srcDirectory, manifest.background.page))
|
||||||
const html = new Buffer(`<html><body>${scripts}</body></html>`)
|
} else {
|
||||||
|
const scripts = manifest.background.scripts.map((name) => {
|
||||||
|
return `<script src="${name}"></script>`
|
||||||
|
}).join('')
|
||||||
|
html = new Buffer(`<html><body>${scripts}</body></html>`)
|
||||||
|
}
|
||||||
|
|
||||||
const contents = webContents.create({
|
const contents = webContents.create({
|
||||||
isBackgroundPage: true,
|
isBackgroundPage: true,
|
||||||
|
|
Loading…
Reference in a new issue