Change getTabs to getWindows

This commit is contained in:
Nick Krichevsky 2018-06-28 20:02:56 -04:00
parent f520372ed4
commit 9ac11c1f42

View file

@ -1,5 +1,16 @@
export {getTabs};
export {getWindows};
function getTabs(callback) {
chrome.tabs.query({}, callback);
let windowCache: chrome.windows.Window[] = [];
/**
* getWindows gets all windows and their tabs, and stores them for future use.
*
* @param {(windows: chrome.windows.Window[]) => void} callback
* @returns {void}
*/
function getWindows(callback: (windows: chrome.windows.Window[]) => void): void {
chrome.windows.getAll({populate: true}, (windows : chrome.windows.Window[]) => {
windowCache = windows;
callback(windows);
});
}