I have a problem with Javascript forcing the [object DOMWindow] into an function I have in an object's prototype. The full error I get is below:
Uncaught TypeError: Object [object DOMWindow] has no method 'positionconvert'
Basically what I'm doing is inside the object prototype under certain conditions I'm creating a var interval
that counts off with window.setInterval()
:
var interval = window.setInterval(this.alertanimate, 500);
the alertanimate
function is inside the same prototype, and uses the this
variable in this line:
this.positionconvert(this.alerticon, -69, 55);
(positionconvert is yet another function, and alerticon is an object). The problem is when I get window.setInterval
involved js starts assuming this
is the DOM and not the object prototype, like I intended, presenting the above error. When I hard-code this to work with a specific object it works, but somewhere in this variable-passing the this
variable loses its connection to the object. I hope this all makes sense? What am I doing wrong?