Skip to content

Commit

Permalink
fix: fix refesh tab on chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
misa198 committed Mar 9, 2022
1 parent 49d18ad commit c06bf49
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/scripts/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ function onOctotreeCheckboxChange() {
}

function reloadCurrentTab() {
const code = 'window.location.reload();';
if (browserName === 'chrome') {
chrome.tabs.getSelected(function (tab) {
chrome.tabs.executeScript(tab.id as number, { code });
chrome.tabs.query({ active: true }, (tabs) => {
chrome.tabs.reload(tabs[0].id as number);
});
} else {
browser.tabs.query({ currentWindow: true, active: true }).then((tabs) => {
browser.tabs.executeScript(tabs[0].id as number, { code });
browser.tabs.executeScript(tabs[0].id as number, {
code: 'window.location.reload();',
});
});
}
buttonSession.classList.add('hide');
Expand Down

0 comments on commit c06bf49

Please sign in to comment.