Skip to content

Commit

Permalink
feat(*): implement connection between content script and devTools pane
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlo s A. Guillen committed Aug 7, 2014
1 parent 2ebab66 commit e81023b
Show file tree
Hide file tree
Showing 11 changed files with 4,743 additions and 757 deletions.
12 changes: 12 additions & 0 deletions HintCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ angular.module('ngHintUI')
$scope.module, $scope.type, $scope.isEmpty = '';

//message data will be an array sent from hint log to batarang to here

// connect to background page
var port = chrome.extension.connect();
port.onMessage.addListener(function(msg) {
$scope.$apply(function () {
$scope.messageData.Directives['Error-Messages'].push(msg + ' ' + Math.random());
});
});
port.onDisconnect.addListener(function (a) {
console.log(a);
});

$scope.messageData = {
'Modules': {
'Error-Messages': ['qwer$scope is a message', 'So issdfs $scope', 'Dont forget asdfsbout me too'],
Expand Down
8 changes: 8 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

chrome.runtime.onConnect.addListener(function(port) {

// context script –> background
chrome.runtime.onMessage.addListener(function(msg, sender, sendResponse) {
port.postMessage(msg);
});
});
Loading

0 comments on commit e81023b

Please sign in to comment.