I am making a Firefox WebExtension. Consequently, I use the relevant API, which, it seems, is not known to WebStorm, hence a lot of warnings.
For example, in the following snippet
//make the panel a drop zone
panel.ondragover = function (τ) {
τ.preventDefault();
τ.dataTransfer.dropEffect = "move";
};
panel.ondrop = function (τ) {
τ.preventDefault();
τ.stopPropagation();
var skware = document.getElementById(
τ.dataTransfer.getData('text'));
skware.style.top = (τ.clientY - skware.mouseOffset.y) + 'px';
skware.style.left = (τ.clientX - skware.mouseOffset.x ) + 'px';
put('skwarePos',
skware.id,
{'top': skware.style.top, 'left': skware.style.left}
);
things like .dataTransfer
would be marked as Unresolved variable.
No big deal, but, surely, there must be a way to tell WebStrom that I'm using Firefox WebExtension JavaScript APIs and that this variable is hence legit.
I found a similar question regarding extensions on Chrome, and did find a library called firefox-Definitely typed, but the squiggly lines remain.
What you need to install isn't the firefox
type definition but firefox-webext-browser
, in the same way outlined in the issue for chrome you mentioned
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With