You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
723 B
JavaScript
34 lines
723 B
JavaScript
11 years ago
|
// Broadcast poll events
|
||
11 years ago
|
angular.module('panelApp', []).
|
||
|
|
||
|
run(function ($rootScope, appContext) {
|
||
|
|
||
|
// todo: kill this
|
||
11 years ago
|
setInterval(function () {
|
||
|
$rootScope.$broadcast('poll');
|
||
|
}, 500);
|
||
11 years ago
|
|
||
|
var port = chrome.extension.connect();
|
||
|
|
||
|
port.onMessage.addListener(function (msg) {
|
||
|
if (msg === 'refresh') {
|
||
|
$rootScope.$apply(function () {
|
||
|
$rootScope.$broadcast('refresh');
|
||
|
});
|
||
|
} else if (msg.action) {
|
||
|
$rootScope.$apply(function () {
|
||
|
$rootScope.$broadcast(msg.action, msg);
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
appContext.getAppId(function (id) {
|
||
|
port.postMessage({
|
||
|
action: 'register',
|
||
|
appId: id,
|
||
|
inspectedTabId: chrome.devtools.inspectedWindow.tabId
|
||
|
});
|
||
|
});
|
||
|
|
||
11 years ago
|
});
|