You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/04/25 02:19:24 UTC

docs commit: [CB-541] added ios quirk regarding resume event

Updated Branches:
  refs/heads/master 0369e90ec -> 4b23832d4


[CB-541] added ios quirk regarding 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/4b23832d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/4b23832d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/4b23832d

Branch: refs/heads/master
Commit: 4b23832d44e78cbf4aa15350cc3ec7cbb3d9300d
Parents: 0369e90
Author: Fil Maj <ma...@gmail.com>
Authored: Tue Apr 24 17:21:40 2012 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Tue Apr 24 17:21:40 2012 -0700

----------------------------------------------------------------------
 docs/en/edge/cordova/events/events.resume.md |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/4b23832d/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 6e5675b..2eeef28 100644
--- a/docs/en/edge/cordova/events/events.resume.md
+++ b/docs/en/edge/cordova/events/events.resume.md
@@ -71,6 +71,16 @@ iOS Quirks
 --------------------------
 Any calls to console.log during your **pause** event handler will be run now when the app resumes, see the iOS Quirks section for the **pause** event for an explanation. 
 
+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);
+    }
+
 - __active__ event 
 
     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).