Updated Branches: refs/heads/master 88e3dfe7b -> 22b80dd9f
[CB-541] Add iOS Quirk for resume event Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/commit/22b80dd9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/22b80dd9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/22b80dd9 Branch: refs/heads/master Commit: 22b80dd9fccdd2438ac5355d343fd6411880044a Parents: 88e3dfe Author: Shazron Abdullah <shaz...@apache.org> Authored: Wed Aug 15 14:37:51 2012 -0700 Committer: Shazron Abdullah <shaz...@apache.org> Committed: Wed Aug 15 14:37:51 2012 -0700 ---------------------------------------------------------------------- docs/en/2.0.0/cordova/events/events.resume.md | 11 +++++++++++ docs/en/edge/cordova/events/events.resume.md | 11 +++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/22b80dd9/docs/en/2.0.0/cordova/events/events.resume.md ---------------------------------------------------------------------- diff --git a/docs/en/2.0.0/cordova/events/events.resume.md b/docs/en/2.0.0/cordova/events/events.resume.md index 899094e..28bcab8 100644 --- a/docs/en/2.0.0/cordova/events/events.resume.md +++ b/docs/en/2.0.0/cordova/events/events.resume.md @@ -95,3 +95,14 @@ Any calls to console.log during your **pause** event handler will be run now whe This iOS specific event is available as a variant of the **resume** event, and is often used to detect when the "Lock" button has been pressed to unlock the device when your app is the foreground app. If your app (and device) is enabled for multi-tasking, this will be paired with a subsequent **resume** event, but only under iOS 5 (effectively all "locked" apps in iOS 5 that have multi-tasking enabled are put to the background). Under iOS 5, if you want your app to still run when the device is locked, you will have to disable multi-tasking (UIApplicationExitsOnSuspend - YES) for your app. This is different when you are on iOS 4 - to have your app run when the device is locked, the multi-tasking setting for your app does not matter. + +- __resume__ event + + Interactive functions like alert() when the resume event fires will need to be wrapped in a setTimeout call with a timeout value of zero, or else the app will hang. e.g. + + document.addEventListener("resume", onResume, false); + function onResume() { + setTimeout(function() { + // TODO: do your thing! + }, 0); + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/22b80dd9/docs/en/edge/cordova/events/events.resume.md ---------------------------------------------------------------------- diff --git a/docs/en/edge/cordova/events/events.resume.md b/docs/en/edge/cordova/events/events.resume.md index 899094e..28bcab8 100644 --- a/docs/en/edge/cordova/events/events.resume.md +++ b/docs/en/edge/cordova/events/events.resume.md @@ -95,3 +95,14 @@ Any calls to console.log during your **pause** event handler will be run now whe This iOS specific event is available as a variant of the **resume** event, and is often used to detect when the "Lock" button has been pressed to unlock the device when your app is the foreground app. If your app (and device) is enabled for multi-tasking, this will be paired with a subsequent **resume** event, but only under iOS 5 (effectively all "locked" apps in iOS 5 that have multi-tasking enabled are put to the background). Under iOS 5, if you want your app to still run when the device is locked, you will have to disable multi-tasking (UIApplicationExitsOnSuspend - YES) for your app. This is different when you are on iOS 4 - to have your app run when the device is locked, the multi-tasking setting for your app does not matter. + +- __resume__ event + + Interactive functions like alert() when the resume event fires will need to be wrapped in a setTimeout call with a timeout value of zero, or else the app will hang. e.g. + + document.addEventListener("resume", onResume, false); + function onResume() { + setTimeout(function() { + // TODO: do your thing! + }, 0); + } \ No newline at end of file