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
// Broadcast poll events
|
|
angular.module('panelApp', []).
|
|
|
|
run(function ($rootScope, appContext) {
|
|
|
|
// todo: kill this
|
|
setInterval(function () {
|
|
$rootScope.$broadcast('poll');
|
|
}, 500);
|
|
|
|
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
|
|
});
|
|
});
|
|
|
|
});
|