0
我试图获得登录代码在后台页面浏览器的启动只运行一次运行。但似乎在bgpage全局代码运行,每上弹出点击时。它也运行在不同的范围。有没有可能解决这个问题?后台代码的任何弹出窗口点击
// background.js
var someCustomType = new SomeCustomType();
function SomeCustomType() {
this.firstProperty;
}
function thisShouldBeCalledOnce() {
someCustomType.firstProperty = 'defined';
alert('someCustomType.firstProperty=' + someCustomType.firstProperty);
console.log('thisShouldBeCalledOnce');
}
if (true) {
// Alwase 'undefined'
alert('someCustomType.firstProperty=' + someCustomType.firstProperty);
thisShouldBeCalledOnce();
}
真的,我发现我的错误,'<脚本类型= “文/ JavaScript的” SRC = “JS/background.js”>'是'popup.html' – Vasya