Support background.page in extension manifest
This commit is contained in:
Родитель
511dceda4e
Коммит
76f4bd01eb
|
@ -72,10 +72,15 @@ const backgroundPages = {}
|
|||
const startBackgroundPages = function (manifest) {
|
||||
if (backgroundPages[manifest.extensionId] || !manifest.background) return
|
||||
|
||||
const scripts = manifest.background.scripts.map((name) => {
|
||||
return `<script src="${name}"></script>`
|
||||
}).join('')
|
||||
const html = new Buffer(`<html><body>${scripts}</body></html>`)
|
||||
let html
|
||||
if (manifest.background.page) {
|
||||
html = fs.readFileSync(path.join(manifest.srcDirectory, manifest.background.page))
|
||||
} 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({
|
||||
isBackgroundPage: true,
|
||||
|
|
Загрузка…
Ссылка в новой задаче