forked from IgorMinar/ng-detector
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
30 lines (25 loc) · 888 Bytes
/
background.js
File metadata and controls
30 lines (25 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
console.log('ng-detector background script started!');
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (typeof request === 'string') {
try {
request = JSON.parse(request);
} catch (e) {}
}
var versionObject = request.angularVersion;
if (versionObject) {
var version = versionObject.codeName
? 'AngularJS ' + versionObject.full + '\n' + versionObject.codeName
: 'Angular'; // maybe AngularDart or lazy-loaded AngularJS?
chrome.pageAction.show(sender.tab.id);
chrome.pageAction.setTitle({
tabId: sender.tab.id,
title: 'Super-powered by \n' + version
});
chrome.pageAction.setIcon({
tabId: sender.tab.id,
path: 'images/icon38.png'
})
console.log(version + ' found at:', sender.tab.url);
}
});