0

So, there is a possibility of me just being really dumb here, but when I try using JavaScript's browser global object, like it is used here, PhpStorm tells me both browser and notifications are "Unresolved".

Screenshot PhpStorm Browser unresolved Screenshot PhpStorm Notifications unresolved

Can anyone explain me why this is occurring or clear up my mistake?

Thanks in advance

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • 2
    What system are you using? `browser` is usually for Node. Browsers don't have a `browser` variable by default. For browsers, [this](https://developer.mozilla.org/en-US/docs/Web/API/notification) might help. – Ouroborus Jul 06 '20 at 10:37
  • 1
    I assume you would need to install intellisense support for browser extension APIs. https://stackoverflow.com/questions/13997468/how-do-i-use-webstorm-for-chrome-extension-development might be a duplicate. – Quentin Jul 06 '20 at 10:40
  • @Ouroborus — I'm not sure how documentation for extension APIs helps with PHPStorm not recognising those extensions in its syntax highlighting. – Quentin Jul 06 '20 at 10:41
  • where does this object come from? There is no such global var in default APIs. – lena Jul 06 '20 at 12:04
  • @Ouroborus also tried it in a node project, which didn't work either. Your hint was useful though – littlegamer757 Jul 06 '20 at 12:31

1 Answers1

0

The answer is really similar to https://stackoverflow.com/a/25466708/2036148 , except the library you need is "firefox-webext-browser".

Settings -> Languages & Frameworks -> JavaScript -> Libraries -> Download -> firefox-webext-browser -> Download and Install -> enable it in the list.

working settings

Edvard Rejthar
  • 1,245
  • 13
  • 14