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