LEFT | RIGHT |
1 "use strict"; | 1 "use strict"; |
2 | 2 |
| 3 (function() |
3 { | 4 { |
4 const backgroundPage = chrome.extension.getBackgroundPage(); | 5 const backgroundPage = chrome.extension.getBackgroundPage(); |
| 6 window.ext = Object.create(backgroundPage.ext); |
5 | 7 |
6 /* eslint-disable no-var */ | 8 window.ext.closePopup = () => |
7 var ext = Object.create(backgroundPage.ext); | |
8 /* eslint-enable no-var */ | |
9 | |
10 ext.closePopup = () => | |
11 { | 9 { |
12 window.close(); | 10 window.close(); |
13 }; | 11 }; |
14 | 12 |
15 // We have to override ext.backgroundPage, because in order | 13 // We have to override ext.backgroundPage, because in order |
16 // to send messages the local "chrome" namespace must be used. | 14 // to send messages the local "chrome" namespace must be used. |
17 ext.backgroundPage = { | 15 window.ext.backgroundPage = { |
18 sendMessage: chrome.runtime.sendMessage, | 16 sendMessage: chrome.runtime.sendMessage, |
19 | 17 |
20 getWindow() | 18 getWindow() |
21 { | 19 { |
22 return backgroundPage; | 20 return backgroundPage; |
23 } | 21 } |
24 }; | 22 }; |
25 } | 23 }()); |
LEFT | RIGHT |