envjs / env-js

A pure-JavaScript browser environment.
http://www.envjs.com/
87 stars 19 forks source link

Timers not cleared when new page is loaded #15

Open orslumen opened 13 years ago

orslumen commented 13 years ago

When a different page is loaded, the timers defined in the old page are still active.

For now I have added the following code to Envjs.exchangeHTMLDocument in core.js: if (doc === window.document) { Envjs.timers.length = 0; }

But that may be too crude a method when there are multiple windows involved.

chrisnash commented 12 years ago

This issue is a killer right now; not only do the timers continue running, but they also block env.js from returning (on the Rhino platform at least) which is causing issues for projects that are using it (such as https://github.com/chilicat/JsChilicat/issues/12 ).

Would hope someone can provide some guidance on the right way to clear the timers, not just on exchangeHTMLDocument but also to make sure env-js doesn't end up getting blocked from exiting.