| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 "use strict"; | 1 "use strict"; |
| 2 | 2 |
| 3 (function() | 3 (function() |
| 4 { | 4 { |
| 5 const backgroundPage = chrome.extension.getBackgroundPage(); | 5 const backgroundPage = chrome.extension.getBackgroundPage(); |
| 6 ext = Object.create(backgroundPage.ext); | 6 window.ext = Object.create(backgroundPage.ext); |
|
Wladimir Palant
2017/03/14 13:03:22
As far as the browser is concerned, ext is an unde
kzar
2017/03/15 04:57:44
Done.
| |
| 7 | 7 |
| 8 ext.closePopup = () => | 8 window.ext.closePopup = () => |
| 9 { | 9 { |
| 10 window.close(); | 10 window.close(); |
| 11 }; | 11 }; |
| 12 | 12 |
| 13 // We have to override ext.backgroundPage, because in order | 13 // We have to override ext.backgroundPage, because in order |
| 14 // to send messages the local "chrome" namespace must be used. | 14 // to send messages the local "chrome" namespace must be used. |
| 15 ext.backgroundPage = { | 15 window.ext.backgroundPage = { |
| 16 sendMessage: chrome.runtime.sendMessage, | 16 sendMessage: chrome.runtime.sendMessage, |
| 17 | 17 |
| 18 getWindow() | 18 getWindow() |
| 19 { | 19 { |
| 20 return backgroundPage; | 20 return backgroundPage; |
| 21 } | 21 } |
| 22 }; | 22 }; |
| 23 }()); | 23 }()); |
| LEFT | RIGHT |