4
我正在创建一个Chrome应用程序。这是我的清单文件。创建全局变量chrome应用程序
{
//...... description and other things
//.......
"app": {
"background": {
"scripts": ["js/main.js"]
}
},
// other things
}
,并在我的js/main.js文件,我已经定义一个全局变量作为全球国际会议。
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('/dashboard.html', {
'bounds': {
'width': screen.availWidth,
'height': screen.availHeight
}
});
});
var globalData;
(这样做的目的,我需要一个变量,可用整个运行时)。 在dashboar.html中我包含了services.js文件。有没有一种方法可以在services.js中使用globalData变量。