Reputation: 217
I have a WinJS application that contains a timer object in it. I've read from the msdn docs that my application would be suspended after 5 seconds from the user navigating to another application, after which my app would stop running.
However, on testing the application in the suspended state, I've noticed that the timer keeps running. I've tried suspending the application by
But in both cases, the timer keeps running. I expected it to stop at the point of suspension and resume with the same time when it is resumed, but instead it showed the elapsed time correctly.
I'd appreciate if anyone could explain this behavior. I'm running Windows 8 Release Preview.
Thanks.
Upvotes: 2
Views: 763
Reputation: 7292
All timers are suspended when the app is suspended. I just verified it with this code:
function timerFired() {
var container = document.getElementById("timeroutput");
var content = document.createElement("div");
content.textContent = Date.now();
container.appendChild(content);
}
setInterval(timerFired, 1000);
When the app goes in the background, and suspends (which takes ~15 seconds before it's suspended), the text stops being appended to.
Note that:
Upvotes: 6