first commit
This commit is contained in:
46
GitHub Desktop-dev/extensions/idikgljglpfilbhaboonnpnnincjhjkd/main.js
Executable file
46
GitHub Desktop-dev/extensions/idikgljglpfilbhaboonnpnnincjhjkd/main.js
Executable file
@@ -0,0 +1,46 @@
|
||||
// Utilities
|
||||
function log(...s) {
|
||||
const string = JSON.stringify(s);
|
||||
chrome.devtools.inspectedWindow.eval('console.log(' + string + ')')
|
||||
};
|
||||
|
||||
// Create panel
|
||||
function createPanel() {
|
||||
chrome.devtools.panels.create('ChromeLens', '', 'panel.html', function(panel) {
|
||||
var _window;
|
||||
var backgroundPageConnection = chrome.runtime.connect();
|
||||
backgroundPageConnection.onMessage.addListener(function (message) {
|
||||
// Handle responses from the background page, if any
|
||||
switch (message.type) {
|
||||
case 'AXS_SHOW_RESULTS': {
|
||||
const { idToWarningsMap } = message.data;
|
||||
if (_window) {
|
||||
_window.showAxsResults(idToWarningsMap);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'HIGHLIGHT_REPORT': {
|
||||
const { warningId } = message.data;
|
||||
if (_window) {
|
||||
_window.highlightReportLine(warningId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'UNHIGHLIGHT_REPORT': {
|
||||
const { warningId } = message.data;
|
||||
if (_window) {
|
||||
_window.unhighlightReportLine(warningId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
panel.onShown.addListener(function(window) {
|
||||
_window = window;
|
||||
});
|
||||
panel.onHidden.addListener(function() {
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
createPanel();
|
||||
Reference in New Issue
Block a user