This repository has been archived on 2020-10-11. You can view files and clone it, but cannot push or open issues or pull requests.
angularjs-batarang/js/background.js

27 lines
698 B
JavaScript
Raw Normal View History

2012-07-02 21:09:51 +00:00
// notify of page refreshes
2013-07-10 02:11:22 +00:00
chrome.extension.onConnect.addListener(function (port) {
2012-07-02 21:09:51 +00:00
port.onMessage.addListener(function (msg) {
if (msg.action === 'register') {
var respond = function (tabId, changeInfo, tab) {
if (tabId !== msg.inspectedTabId) {
return;
}
port.postMessage('refresh');
};
chrome.tabs.onUpdated.addListener(respond);
port.onDisconnect.addListener(function () {
chrome.tabs.onUpdated.removeListener(respond);
});
}
});
2013-07-10 02:11:22 +00:00
chrome.extension.onMessage.addListener(function (msg) {
2013-07-15 22:59:44 +00:00
if (msg.action === 'modelChange' || msg.action === 'scopeChange') {
2013-07-10 02:11:22 +00:00
port.postMessage(msg);
}
});
2012-07-02 21:09:51 +00:00
});
2013-07-10 02:11:22 +00:00