user1856596
user1856596

Reputation: 7233

Window is not a constructor error?

I have this code in a JavaScript file:

this.tooltipWindow = new Window("__tooltip__", TooltipManager.options);

This gives me the TypeError: Window is not a constructor error in Firefox. Is there something wrong with this code and yes, how can I rewrite it, so it works?

Thanks!

Upvotes: 1

Views: 5244

Answers (2)

Katana314
Katana314

Reputation: 8620

If you have a type defined by the word "Window", it's likely interfering with the actual 'window' object that exists on all pages.

If you're actually trying to create a new 'Window', as in the browser-typed object, that way, then I think that you're entering into some unfamiliar areas to me...are you just trying to create a popup window?

https://developer.mozilla.org/en-US/docs/Web/API/Window.open

Upvotes: 1

Remco van Dalen
Remco van Dalen

Reputation: 304

A quick search on that line of code pointed me to a library called ATK, specifically the tooltip.js file. At first glance it's quite a complete library, but it seems like you are only using tooltip.js. Since the Window class is defined in window.js you'll need to include that script as well to make it work. I don't know the framework myself, so it might be wise to check if it even supports cherry-picking specific pieces of code like that.

Upvotes: 0

Related Questions