forked from nisargkolhe/arcify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchromeHelper.js
More file actions
23 lines (21 loc) · 764 Bytes
/
chromeHelper.js
File metadata and controls
23 lines (21 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const ChromeHelper = {
createNewTab: async function() {
const newTab = await new Promise((resolve, reject) => {
chrome.tabs.create({ active: true }, (tab) => {
if (chrome.runtime.lastError) {
reject(chrome.runtime.lastError);
} else {
resolve(tab);
}
});
});
return newTab;
},
createNewTabGroup: async function(newTab, spaceName, spaceColor) {
// Create a new tab group with the new tab
const groupId = await chrome.tabs.group({ tabIds: [newTab.id] });
await chrome.tabGroups.update(groupId, { title: spaceName, color: spaceColor });
return groupId;
}
}
export { ChromeHelper };