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