Skip to content

Instantly share code, notes, and snippets.

@jxpx777
Created March 29, 2013 23:04
Show Gist options
  • Save jxpx777/5274270 to your computer and use it in GitHub Desktop.
Save jxpx777/5274270 to your computer and use it in GitHub Desktop.
var pageModParams = {
'include': ["*"],
'attachTo': ["top", "existing", "frame"],
'contentScriptFile': [
data.url("src/common.js"),
data.url("src/end.js")
//other scripts to include
]
};
function attachWorkerToTab(tab){
var worker;
if (!tab) tab = tabs.activeTab
if (workersForTab(tab).length > 0) return;
worker = tab['attach'](pageModParams);
//configure worker listener stuff
}
tabs.on('activate', function(tab) {
if (DEBUG_FIREFOX) console.log("[FIREFOX] activating tab " + tab.url);
attachWorkerToTab(tab);
});
tabs.on('ready', function(tab) {
if (DEBUG_FIREFOX) console.log("[FIREFOX] tab ready " + tab.url);
attachWorkerToTab(tab);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment