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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
angularjs-batarang/hintService.js

30 lines
782 B
JavaScript

angular.module('ngHintUI').
service('hintService', function() {
var onHintFunction, onRefreshFunction;
this.setHintFunction = function(hintFunction) {
onHintFunction = hintFunction;
}
this.getHintFunction = function() {
return onHintFunction;
}
this.setRefreshFunction = function(refreshFunction) {
onRefreshFunction = refreshFunction;
}
this.getRefreshFunction = function() {
return onRefreshFunction;
}
var port = chrome.extension.connect();
port.postMessage(chrome.devtools.inspectedWindow.tabId);
port.onMessage.addListener(function(msg) {
msg == 'refresh' ? onRefreshFunction() : onHintFunction(msg);
});
port.onDisconnect.addListener(function (a) {
console.log(a);
});
});