Kocal / vue-web-extension

🛠️ A Vue CLI 3+ preset (previously a Vue CLI 2 boilerplate) for quickly starting a web extension with Vue, Babel, ESLint and more!
https://vue-web-extension.netlify.app/
MIT License
1.58k stars 167 forks source link

Cannot read property 'getCurrent' of undefined" #659

Closed marvinhosea closed 3 years ago

marvinhosea commented 3 years ago

I am trying to run chrome apis in vue files but I am getting undefined on chrome. Maybe I am doing something wrong how do I manage to run chrome APIs in Vue files

chrome.windows.getCurrent(function(currentWindow) {
    currentWindowId = currentWindow.id;
    chrome.windows.getLastFocused(function(focusedWindow) {
      focusedWindowId = focusedWindow.id;
      loadWindowList();
    });
  });

Expect run chrome APIs

Kocal commented 3 years ago

Can you try using browser.windows.getGurrent instead?

marvinhosea commented 3 years ago

I figured out content script has no access to tabs API. I think someone needs to do a course or video tutorial on how to use this package and charge or offer it free for beginners. You can get some $ doing that or I can do it and share revenue let me know.

Closing this.