我正在为Chrome创建扩展程序,但我需要解决“问题”,并希望得到您的帮助。
我有以下代码:
var myExt = "a"
console.log("before");
ext = chrome.management.get("hfdmpdnhnohjbkogdjehnjbmefgekaii", function(a){
myVar = a;
console.log("(callback) myExt = " + a.id);
});
console.log("ext = " + ext);
console.log("myExt = " + myExt);
console.log("after");
这是回报:
之前
ext = undefined
myExt = a
后 (回调)myExt = hfdmpdnhnohjbkogdjehnjbmefgekaii
我的问题是:
谢谢!