[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/8fc9ea95 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/8fc9ea95 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/8fc9ea95 Branch: refs/heads/master Commit: 8fc9ea950639cf3f0fc5bd9af2e8557ba02839b1 Parents: 5d76b66 Author: Shazron Abdullah <shaz...@apache.org> Authored: Wed Aug 15 14:37:51 2012 -0700 Committer: Anis Kadri <anis.ka...@gmail.com> Committed: Fri Aug 24 16:59:40 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/8fc9ea95/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/8fc9ea95/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