OLD | NEW |
1 (function() | |
2 { | 1 { |
3 var backgroundPage = chrome.extension.getBackgroundPage(); | 2 let backgroundPage = chrome.extension.getBackgroundPage(); |
4 window.ext = Object.create(backgroundPage.ext); | 3 window.ext = Object.create(backgroundPage.ext); |
5 | 4 |
6 ext.closePopup = function() | 5 ext.closePopup = () => |
7 { | 6 { |
8 window.close(); | 7 window.close(); |
9 }; | 8 }; |
10 | 9 |
11 // We have to override ext.backgroundPage, because in order | 10 // We have to override ext.backgroundPage, because in order |
12 // to send messages the local "chrome" namespace must be used. | 11 // to send messages the local "chrome" namespace must be used. |
13 ext.backgroundPage = { | 12 ext.backgroundPage = { |
14 sendMessage: chrome.runtime.sendMessage, | 13 sendMessage: chrome.runtime.sendMessage, |
15 | 14 |
16 getWindow: function() | 15 getWindow: () => backgroundPage |
17 { | |
18 return backgroundPage; | |
19 } | |
20 }; | 16 }; |
21 })(); | 17 } |
OLD | NEW |