Reputation: 8586
I want to trigger a function before closing my metro app but I don't know where such as
app.onactivated = function (args){
//all the actions here will be executed on app's activation
}
I want something for deactivation or app's closure, what's the proper way to do this in WinJS
Upvotes: 1
Views: 505
Reputation: 4763
Look at the documentation for both onunload and oncheckpoint. There are differences and you may need one or the other.
Upvotes: 3
Reputation: 13273
I think you'll actually want to tie into the WinJS.Application
unload
event, which is really just a wrapper for window.onunload
, but is the "Windows 8" way to do it:
WinJS.Application.addEventListener("unload", function(e) {
// do any needed clean up
});
Upvotes: 2