denet.js 678 B

12345678910111213141516171819202122
  1. import { getChromeStorage } from '@/uilts/chromeExtension.js'
  2. export const closeAchPayNoticeHandler = async () => {
  3. let {id} = await getCurrentTab();
  4. chrome.tabs.remove(
  5. id, () => {
  6. getChromeStorage('achPayInfo', (res) => {
  7. chrome.storage.local.remove("achPayInfo");
  8. if(res && res.tab) {
  9. chrome.tabs.highlight({ windowId: res.tab.windowId, tabs: res.tab.index })
  10. }
  11. })
  12. }
  13. )
  14. }
  15. const getCurrentTab = async () => {
  16. let queryOptions = { active: true, lastFocusedWindow: true };
  17. let [tab] = await chrome.tabs.query(queryOptions);
  18. return tab || {};
  19. }