I have a very very simple bit of code in my (test) Chrome extension:
function test()
{
alert(\"In test!\");
}
chrome.tabs.onUpdated.addLi
When you write the following code:
chrome.tabs.onUpdated.addListener(function(tabid, changeinfo, tab) {
var url = tab.url;
if (url !== undefined) {
test();
}
});
You're calling addListener
and telling it to call test()
not immediately but rather whenever the tab is updated. Tab update events are broadcast by the Chrome browser itself, which in turn, causes your test()
code to run.