I got the following code (in a separate page.js file):
var page = new function() {
this.getImdbID = function(){
var imdbid = '';
chrome.tabs.getSelected(null, function(tab) {
imdbid='0944835';
});
return imdbid;
};
}
which is called by the following code (which is in background.html).
var imdbid = page.getImdbID();
This code only works when I put a breakpoint on "return imdbid;" row. When I skip a breakpoint, it returns only an empty string. Is there something I missed?
source
share