【发布时间】:2013-09-24 07:13:08
【问题描述】:
我的 Chrome 打包应用程序有 2 个 JavaScript 文件。
1. background.js 是 manifest.json 调用的主要 JavaScript 文件
var foo = 'sss';
function bar(a,b) {
return a+b;
}
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html', {
bounds: {
width: 500,
height: 300
}
});
});
2。 app.js 是 index.html 的控制器
问题:我可以从 app.js 中的 background.js 调用变量“foo”或函数“bar”吗?
PS. 或者有任何解决方案在页面之间转移价值,例如 chrome.storage ?
【问题讨论】:
标签: javascript html google-chrome-app