Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 "use strict"; | 1 "use strict"; |
2 | 2 |
3 { | 3 { |
4 const backgroundPage = chrome.extension.getBackgroundPage(); | 4 const backgroundPage = chrome.extension.getBackgroundPage(); |
5 window.ext = Object.create(backgroundPage.ext); | 5 var ext = Object.create(backgroundPage.ext); |
Sebastian Noack
2017/01/18 11:24:26
Assigning to the global object (i.e. window) isn't
kzar
2017/01/18 11:46:36
Done.
| |
6 | 6 |
7 ext.closePopup = () => | 7 ext.closePopup = () => |
8 { | 8 { |
9 window.close(); | 9 window.close(); |
10 }; | 10 }; |
11 | 11 |
12 // We have to override ext.backgroundPage, because in order | 12 // We have to override ext.backgroundPage, because in order |
13 // to send messages the local "chrome" namespace must be used. | 13 // to send messages the local "chrome" namespace must be used. |
14 ext.backgroundPage = { | 14 ext.backgroundPage = { |
15 sendMessage: chrome.runtime.sendMessage, | 15 sendMessage: chrome.runtime.sendMessage, |
16 | 16 |
17 getWindow() | 17 getWindow() |
18 { | 18 { |
19 return backgroundPage; | 19 return backgroundPage; |
20 } | 20 } |
21 }; | 21 }; |
22 } | 22 } |
LEFT | RIGHT |