denet.js 853 B

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