| Index: chrome/ext/background.js |
| diff --git a/chrome/ext/background.js b/chrome/ext/background.js |
| index 1e3753ab985cd10ebe6561d6283b1469aa4e2994..d3a4979c332d8f930866ad408b1b2944b6974567 100644 |
| --- a/chrome/ext/background.js |
| +++ b/chrome/ext/background.js |
| @@ -100,7 +100,8 @@ |
| }); |
| }, |
| onLoading: new ext._EventTarget(), |
| - onActivated: new ext._EventTarget() |
| + onActivated: new ext._EventTarget(), |
| + onRemoved: new ext._EventTarget() |
| }; |
| chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) |
| @@ -138,6 +139,8 @@ |
| function forgetTab(tabId) |
| { |
| + ext.pages.onRemoved._dispatch(tabId); |
|
Sebastian Noack
2016/02/10 12:26:56
I guess we should dispatch the event with a Page o
kzar
2016/02/10 14:20:16
I wasn't sure how well it would work using a Page
|
| + |
| ext._removeFromAllPageMaps(tabId); |
| delete framesOfTabs[tabId]; |
| } |
| @@ -586,4 +589,27 @@ |
| }); |
| }); |
| }; |
| + |
| + /* Windows */ |
| + ext.windows = { |
| + create: (createData, callback) => |
|
Sebastian Noack
2016/02/10 12:26:56
Nit: I'm not sure if using an arrow function is ap
kzar
2016/02/10 14:20:16
Done.
|
| + { |
| + if (callback) |
|
Sebastian Noack
2016/02/10 12:26:57
The logic here is duplicated from ext.tabs.open. W
kzar
2016/02/10 14:20:16
Done.
|
| + chrome.windows.create(createData, createdWindow => |
| + { |
| + let createdTab = createdWindow.tabs[0]; |
| + var onUpdated = (tabId, changeInfo, tab) => |
| + { |
| + if (tabId == createdTab.id && changeInfo.status == "complete") |
| + { |
| + chrome.tabs.onUpdated.removeListener(onUpdated); |
| + callback(new Page(createdTab)); |
| + } |
| + }; |
| + chrome.tabs.onUpdated.addListener(onUpdated); |
| + }); |
| + else |
| + chrome.windows.create(createData); |
| + } |
| + }; |
| })(); |