forked from javaccy/stash-tabs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
24 lines (23 loc) · 755 Bytes
/
background.js
File metadata and controls
24 lines (23 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
chrome.runtime.onStartup.addListener(() => {
chrome.promise.storage.local.clear();
});
window.unstash = async function(
stashId, stash, shouldUpdateMessages, shouldOpenInCurrentWindow,
chromeWindow) {
await deleteStash(stashId);
if (shouldOpenInCurrentWindow) {
await openStashInExistingWindow(stash, chromeWindow);
} else {
if (chromeWindow.tabs.length == 1 &&
chromeWindow.tabs[0].url == 'chrome://newtab/') {
// Don't wait.
chrome.promise.windows.remove(chromeWindow.id);
}
chromeWindow = await openStash(stash);
}
await chrome.promise.storage.local.set(
{[getStashNameStorageKey(chromeWindow.id)]: stash.name});
if (shouldUpdateMessages) {
await setMessageRead('openStash');
}
};