Repository: cordova-docs Updated Branches: refs/heads/master 11ff3e8d1 -> a461a3d53
CB-10351: Make Events page a reference Made the Events page a reference Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/a461a3d5 Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/a461a3d5 Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/a461a3d5 Branch: refs/heads/master Commit: a461a3d532818ff44e14f0338b074deda7c82307 Parents: 11ff3e8 Author: Sarangan Rajamanickam <[email protected]> Authored: Tue Feb 2 13:31:23 2016 -0800 Committer: Sarangan Rajamanickam <[email protected]> Committed: Thu Feb 4 10:59:01 2016 -0800 ---------------------------------------------------------------------- www/docs/en/dev/config.json | 12 +- .../en/dev/cordova/events/events.backbutton.md | 84 ---- .../en/dev/cordova/events/events.deviceready.md | 92 ----- .../dev/cordova/events/events.endcallbutton.md | 81 ---- www/docs/en/dev/cordova/events/events.md | 393 ++++++++++++++++++- .../en/dev/cordova/events/events.menubutton.md | 83 ---- www/docs/en/dev/cordova/events/events.pause.md | 104 ----- www/docs/en/dev/cordova/events/events.resume.md | 117 ------ .../dev/cordova/events/events.searchbutton.md | 82 ---- .../cordova/events/events.startcallbutton.md | 82 ---- .../cordova/events/events.volumedownbutton.md | 83 ---- .../dev/cordova/events/events.volumeupbutton.md | 83 ---- www/docs/en/dev/guide/cli/index.md | 8 +- www/docs/en/dev/guide/next/index.md | 3 +- .../dev/guide/platforms/amazonfireos/config.md | 5 +- .../en/dev/guide/platforms/android/config.md | 5 +- .../en/dev/guide/platforms/android/plugin.md | 5 +- www/docs/en/dev/guide/platforms/ios/plugin.md | 6 +- www/docs/en/dev/guide/platforms/wp8/plugin.md | 5 +- 19 files changed, 400 insertions(+), 933 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/config.json ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/config.json b/www/docs/en/dev/config.json index 99f6553..75290eb 100644 --- a/www/docs/en/dev/config.json +++ b/www/docs/en/dev/config.json @@ -2,17 +2,7 @@ "language": "English", "merge": { "events.md": [ - "cordova/events/events.md", - "cordova/events/events.deviceready.md", - "cordova/events/events.pause.md", - "cordova/events/events.resume.md", - "cordova/events/events.backbutton.md", - "cordova/events/events.menubutton.md", - "cordova/events/events.searchbutton.md", - "cordova/events/events.startcallbutton.md", - "cordova/events/events.endcallbutton.md", - "cordova/events/events.volumedownbutton.md", - "cordova/events/events.volumeupbutton.md" + "cordova/events/events.md" ] } } http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/cordova/events/events.backbutton.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/cordova/events/events.backbutton.md b/www/docs/en/dev/cordova/events/events.backbutton.md deleted file mode 100644 index 1e29e95..0000000 --- a/www/docs/en/dev/cordova/events/events.backbutton.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -license: > - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - -title: backbutton ---- - -# backbutton - -The event fires when the user presses the back button. - - document.addEventListener("backbutton", yourCallbackFunction, false); - -## Details - -To override the default back-button behavior, register an event -listener for the `backbutton` event, typically by calling -`document.addEventListener` once you receive the `[deviceready](events.deviceready.html)` event. -It is no longer necessary to call any other method to override the -back-button behavior. - -## Supported Platforms - -- Amazon Fire OS -- Android -- BlackBerry 10 -- Windows Phone 8 - -## Quick Example - - document.addEventListener("backbutton", onBackKeyDown, false); - - function onBackKeyDown() { - // Handle the back button - } - -## Full Example - - <!DOCTYPE html> - <html> - <head> - <title>Back Button Example</title> - - <script type="text/javascript" charset="utf-8" src="cordova.js"></script> - <script type="text/javascript" charset="utf-8"> - - // Wait for device API libraries to load - // - function onLoad() { - document.addEventListener("deviceready", onDeviceReady, false); - } - - // device APIs are available - // - function onDeviceReady() { - // Register the event listener - document.addEventListener("backbutton", onBackKeyDown, false); - } - - // Handle the back button - // - function onBackKeyDown() { - } - - </script> - </head> - <body onload="onLoad()"> - </body> - </html> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/cordova/events/events.deviceready.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/cordova/events/events.deviceready.md b/www/docs/en/dev/cordova/events/events.deviceready.md deleted file mode 100644 index 58dc99a..0000000 --- a/www/docs/en/dev/cordova/events/events.deviceready.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -license: > - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - -title: deviceready ---- - -# deviceready - -The event fires when Cordova is fully loaded. - - document.addEventListener("deviceready", yourCallbackFunction, false); - -## Details - -This event is essential to any application. It signals that Cordova's -device APIs have loaded and are ready to access. - -Cordova consists of two code bases: native and JavaScript. While the -native code loads, a custom loading image displays. However, -JavaScript only loads once the DOM loads. This means the web app may -potentially call a Cordova JavaScript function before the -corresponding native code becomes available. - -The `deviceready` event fires once Cordova has fully loaded. Once the -event fires, you can safely make calls to Cordova APIs. Applications -typically attach an event listener with `document.addEventListener` -once the HTML document's DOM has loaded. - -The `deviceready` event behaves somewhat differently from others. Any -event handler registered after the `deviceready` event fires has its -callback function called immediately. - -## Supported Platforms - -- Amazon Fire OS -- Android -- BlackBerry 10 -- iOS -- Windows Phone 8 -- Windows 8 - -## Quick Example - - document.addEventListener("deviceready", onDeviceReady, false); - - function onDeviceReady() { - // Now safe to use device APIs - } - -## Full Example - - <!DOCTYPE html> - <html> - <head> - <title>Device Ready Example</title> - - <script type="text/javascript" charset="utf-8" src="cordova.js"></script> - <script type="text/javascript" charset="utf-8"> - - // Wait for device API libraries to load - // - function onLoad() { - document.addEventListener("deviceready", onDeviceReady, false); - } - - // device APIs are available - // - function onDeviceReady() { - // Now safe to use device APIs - } - - </script> - </head> - <body onload="onLoad()"> - </body> - </html> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/cordova/events/events.endcallbutton.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/cordova/events/events.endcallbutton.md b/www/docs/en/dev/cordova/events/events.endcallbutton.md deleted file mode 100644 index 7a98fa4..0000000 --- a/www/docs/en/dev/cordova/events/events.endcallbutton.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -license: > - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - -title: endcallbutton ---- - -# endcallbutton - -This event fires when the user presses the end call button. - - document.addEventListener("endcallbutton", yourCallbackFunction, false); - -## Details - -The event overrides the default end call behavior. - -Applications typically should use `document.addEventListener` to -attach an event listener once the `[deviceready](events.deviceready.html)` event fires. - -## Supported Platforms - -- BlackBerry 10 - -## Quick Example - - document.addEventListener("endcallbutton", onEndCallKeyDown, false); - - function onEndCallKeyDown() { - // Handle the end call button - } - -## Full Example - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" - "http://www.w3.org/TR/html4/strict.dtd"> - <html> - <head> - <title>End Call Button Example</title> - - <script type="text/javascript" charset="utf-8" src="cordova.js"></script> - <script type="text/javascript" charset="utf-8"> - - // Wait for device API libraries to load - // - function onLoad() { - document.addEventListener("deviceready", onDeviceReady, false); - } - - // device APIs are available - // - function onDeviceReady() { - // Register the event listener - document.addEventListener("endcallbutton", onEndCallKeyDown, false); - } - - // Handle the end call button - // - function onEndCallKeyDown() { - } - - </script> - </head> - <body onload="onLoad()"> - </body> - </html> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/cordova/events/events.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/cordova/events/events.md b/www/docs/en/dev/cordova/events/events.md index e5b5faf..2f650fe 100644 --- a/www/docs/en/dev/cordova/events/events.md +++ b/www/docs/en/dev/cordova/events/events.md @@ -22,29 +22,384 @@ title: Events # Events -> Cordova lifecycle events. +There are various events provided by cordova to be used by the application. +The application code could add listeners for these events. For example: -## Event Types +**HTML File** -- [deviceready](events.deviceready.html) -- [pause](events.pause.html) -- [resume](events.resume.html) -- [backbutton](events.backbutton.html) -- [menubutton](events.menubutton.html) -- [searchbutton](events.searchbutton.html) -- [startcallbutton](events.startcallbutton.html) -- [endcallbutton](events.endcallbutton.html) -- [volumedownbutton](events.volumedownbutton.html) -- [volumeupbutton](events.volumeupbutton.html) + <!DOCTYPE html> + <html> + <head> + <title>Device Ready Example</title> -## Events added by [cordova-plugin-battery-status](https://github.com/apache/cordova-plugin-battery-status/blob/master/README.md) + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8" src="example.js"></script> + </head> + <body onload="onLoad()"> + </body> + </html> -- batterycritical -- batterylow -- batterystatus +**JS File** -## Events added by [cordova-plugin-network-information](https://github.com/apache/cordova-plugin-network-information/blob/master/README.md) + // example.js file + // Wait for device API libraries to load + // + function onLoad() { + document.addEventListener("deviceready", onDeviceReady, false); + } -- online -- offline + // device APIs are available + // + function onDeviceReady() { + document.addEventListener("pause", onPause, false); + document.addEventListener("resume", onResume, false); + document.addEventListener("menubutton", onMenuKeyDown, false); + // Add similar listeners for other events + } + function onPause() { + // Handle the pause event + } + + function onResume() { + // Handle the resume event + } + + function onMenuKeyDown() { + // Handle the menubutton event + } + + // Add similar event handlers for other events + +**Note**: Applications typically should use `document.addEventListener` to +attach an event listener once the [deviceready](#link-deviceready) +event fires. + +The following table lists the cordova events and the supported platforms: + +<!-- START HTML --> + +<table class="compat" width="100%"> + +<thead> + <tr> + <th>Supported Platforms/<br/>Events</td> + <th>amazon-fireos</th> + <th>android</th> + <th>blackberry10</th> + <th>ios</th> + <th>Windows Phone 8</th> + <th>Windows</th> + </tr> +</thead> + +<tbody> + <tr> + <th><a href="#link-deviceready">deviceready</a></th> + <td data-col="amazon-fireos" class="y"></td> + <td data-col="android" class="y"></td> + <td data-col="blackberry10" class="y"></td> + <td data-col="ios" class="y"></td> + <td data-col="winphone8" class="y"></td> + <td data-col="win" class="y"></td> + </tr> + + <tr> + <th><a href="#link-pause">pause</a></th> + <td data-col="amazon-fireos" class="y"></td> + <td data-col="android" class="y"></td> + <td data-col="blackberry10" class="y"></td> + <td data-col="ios" class="y"></td> + <td data-col="winphone8" class="y"></td> + <td data-col="win" class="y"></td> + </tr> + + <tr> + <th><a href="#link-resume">resume</a></th> + <td data-col="amazon-fireos" class="y"></td> + <td data-col="android" class="y"></td> + <td data-col="blackberry10" class="y"></td> + <td data-col="ios" class="y"></td> + <td data-col="winphone8" class="y"></td> + <td data-col="win" class="y"></td> + </tr> + + <tr> + <th><a href="#link-backbutton">backbutton</a></th> + <td data-col="amazon-fireos" class="y"></td> + <td data-col="android" class="y"></td> + <td data-col="blackberry10" class="y"></td> + <td data-col="ios" class="n"></td> + <td data-col="winphone8" class="n"></td> + <td data-col="win" class="y"></td> + </tr> + + <tr> + <th><a href="#link-menubutton">menubutton</a></th> + <td data-col="amazon-fireos" class="y"></td> + <td data-col="android" class="y"></td> + <td data-col="blackberry10" class="y"></td> + <td data-col="ios" class="n"></td> + <td data-col="winphone8" class="n"></td> + <td data-col="win" class="n"></td> + </tr> + + <tr> + <th><a href="#link-searchbutton">searchbutton</a></th> + <td data-col="amazon-fireos" class="n"></td> + <td data-col="android" class="y"></td> + <td data-col="blackberry10" class="n"></td> + <td data-col="ios" class="n"></td> + <td data-col="winphone8" class="n"></td> + <td data-col="win" class="n"></td> + </tr> + + <tr> + <th><a href="#link-startcallbutton">startcallbutton</a></th> + <td data-col="amazon-fireos" class="n"></td> + <td data-col="android" class="n"></td> + <td data-col="blackberry10" class="y"></td> + <td data-col="ios" class="n"></td> + <td data-col="winphone8" class="n"></td> + <td data-col="win" class="n"></td> + </tr> + + <tr> + <th><a href="#link-endcallbutton">endcallbutton</a></th> + <td data-col="amazon-fireos" class="n"></td> + <td data-col="android" class="n"></td> + <td data-col="blackberry10" class="y"></td> + <td data-col="ios" class="n"></td> + <td data-col="winphone8" class="n"></td> + <td data-col="win" class="n"></td> + </tr> + + <tr> + <th><a href="#link-volumedownbutton">volumedownbutton</a></th> + <td data-col="amazon-fireos" class="n"></td> + <td data-col="android" class="y"></td> + <td data-col="blackberry10" class="y"></td> + <td data-col="ios" class="n"></td> + <td data-col="winphone8" class="n"></td> + <td data-col="win" class="n"></td> + </tr> + + <tr> + <th><a href="#link-volumeupbutton">volumeupbutton</a></th> + <td data-col="amazon-fireos" class="n"></td> + <td data-col="android" class="y"></td> + <td data-col="blackberry10" class="y"></td> + <td data-col="ios" class="n"></td> + <td data-col="winphone8" class="n"></td> + <td data-col="win" class="n"></td> + </tr> +</tbody> +</table> + +<!-- END HTML --> + + +## deviceready + +The deviceready event fires when Cordova is fully loaded. This event is +essential to any application. It signals that Cordova's device APIs have +loaded and are ready to access. + +Cordova consists of two code bases: native and JavaScript. While the +native code loads, a custom loading image displays. However, +JavaScript only loads once the DOM loads. This means the web app may +potentially call a Cordova JavaScript function before the +corresponding native code becomes available. + +The `deviceready` event fires once Cordova has fully loaded. Once the +event fires, you can safely make calls to Cordova APIs. Applications +typically attach an event listener with `document.addEventListener` +once the HTML document's DOM has loaded. + +The `deviceready` event behaves somewhat differently from others. Any +event handler registered after the `deviceready` event fires has its +callback function called immediately. + +### Quick Example + + document.addEventListener("deviceready", onDeviceReady, false); + + function onDeviceReady() { + // Now safe to use device APIs + } + +## pause + +The pause event fires when the native platform puts the application into the background, +typically when the user switches to a different application. + +### Quick Example + + document.addEventListener("pause", onPause, false); + + function onPause() { + // Handle the pause event + } + +### iOS Quirks + +In the `pause` handler, any calls to the Cordova API or to native +plugins that go through Objective-C do not work, along with any +interactive calls, such as alerts or `console.log()`. They are only +processed when the app resumes, on the next run loop. + +The iOS-specific `resign` event is available as an alternative to +`pause`, and detects when users enable the __Lock__ button to lock the +device with the app running in the foreground. If the app (and +device) is enabled for multi-tasking, this is paired with a subsequent +`pause` event, but only under iOS 5. In effect, all locked apps in iOS +5 that have multi-tasking enabled are pushed to the background. For +apps to remain running when locked under iOS 5, disable the app's +multi-tasking by setting [UIApplicationExitsOnSuspend][UIApplicationExitsOnSuspend] +to `YES`. To run when locked on iOS 4, this setting does not matter. + +## resume + +The `resume` event fires when the native platform pulls the application out from the background. + +### Quick Example + + document.addEventListener("resume", onResume, false); + + function onResume() { + // Handle the resume event + } + +### iOS Quirks + +Any interactive functions called from a [pause](#link-pause) event handler execute +later when the app resumes, as signaled by the `resume` event. These +include alerts, `console.log()`, and any calls from plugins or the +Cordova API, which go through Objective-C. + +- __active__ event + + The iOS-specific `active` event is available as an alternative to +`resume`, and detects when users disable the __Lock__ button to unlock +the device with the app running in the foreground. If the app (and +device) is enabled for multi-tasking, this is paired with a subsequent +`resume` event, but only under iOS 5. In effect, all locked apps in +iOS 5 that have multi-tasking enabled are pushed to the background. +For apps to remain running when locked under iOS 5, disable the app's +multi-tasking by setting [UIApplicationExitsOnSuspend][UIApplicationExitsOnSuspend] +to `YES`. To run when locked on iOS 4, this setting does not matter. + +- __resume__ event + + When called from a `resume` event handler, interactive functions such +as `alert()` need to be wrapped in a `setTimeout()` call with a +timeout value of zero, or else the app hangs. For example: + + document.addEventListener("resume", onResume, false); + function onResume() { + setTimeout(function() { + // TODO: do your thing! + }, 0); + } + +### Android Quirks + +Refer [Android Life Cycle Guide][AndroidLifeCycleGuide] for details on android quirks with +the `resume` event. + +## backbutton + +The event fires when the user presses the back button. To override the default +back-button behavior, register an event listener for the `backbutton` event. +It is no longer necessary to call any other method to override the +back-button behavior. + +### Quick Example + + document.addEventListener("backbutton", onBackKeyDown, false); + + function onBackKeyDown() { + // Handle the back button + } + +## menubutton + +The event fires when the user presses the menu button. Applying an event handler +overrides the default menu button behavior. + +### Quick Example + + document.addEventListener("menubutton", onMenuKeyDown, false); + + function onMenuKeyDown() { + // Handle the back button + } + +## searchbutton + +The event fires when the user presses the search button on Android. If you need to +override the default search button behavior on Android you can register an event +listener for the 'searchbutton' event. + +### Quick Example + + document.addEventListener("searchbutton", onSearchKeyDown, false); + + function onSearchKeyDown() { + // Handle the search button + } + +## startcallbutton + +The event fires when the user presses the start call button. If you need to override +the default start call behavior you can register an event listener for the `startcallbutton` event. + +### Quick Example + + document.addEventListener("startcallbutton", onStartCallKeyDown, false); + + function onStartCallKeyDown() { + // Handle the start call button + } + +## endcallbutton + +This event fires when the user presses the end call button. The event overrides the +default end call behavior. + +### Quick Example + + document.addEventListener("endcallbutton", onEndCallKeyDown, false); + + function onEndCallKeyDown() { + // Handle the end call button + } + +## volumedownbutton + +The event fires when the user presses the volume down button. If you need to override +the default volume down behavior you can register an event listener for the `volumedownbutton` event. + +### Quick Example + + document.addEventListener("volumedownbutton", onVolumeDownKeyDown, false); + + function onVolumeDownKeyDown() { + // Handle the volume down button + } + +## volumeupbutton + +The event fires when the user presses the volume up button. If you need to override +the default volume up behavior you can register an event listener for the `volumeupbutton` event. + +### Quick Example + + document.addEventListener("volumeupbutton", onVolumeUpKeyDown, false); + + function onVolumeUpKeyDown() { + // Handle the volume up button + } + +[UIApplicationExitsOnSuspend]: http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html +[AndroidLifeCycleGuide]: ../../guide/platforms/android/lifecycle.html http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/cordova/events/events.menubutton.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/cordova/events/events.menubutton.md b/www/docs/en/dev/cordova/events/events.menubutton.md deleted file mode 100644 index 80ada4f..0000000 --- a/www/docs/en/dev/cordova/events/events.menubutton.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -license: > - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - -title: menubutton ---- - -# menubutton - -The event fires when the user presses the menu button. - - document.addEventListener("menubutton", yourCallbackFunction, false); - -## Details - -Applying an event handler overrides the default menu button behavior. - -Applications typically should use `document.addEventListener` to -attach an event listener once the `[deviceready](events.deviceready.html)` event fires. - -## Supported Platforms - -- Amazon Fire OS -- Android -- BlackBerry 10 - -## Quick Example - - document.addEventListener("menubutton", onMenuKeyDown, false); - - function onMenuKeyDown() { - // Handle the back button - } - -## Full Example - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" - "http://www.w3.org/TR/html4/strict.dtd"> - <html> - <head> - <title>Menu Button Example</title> - - <script type="text/javascript" charset="utf-8" src="cordova.js"></script> - <script type="text/javascript" charset="utf-8"> - - // Wait for device API libraries to load - // - function onLoad() { - document.addEventListener("deviceready", onDeviceReady, false); - } - - // device APIs are available - // - function onDeviceReady() { - // Register the event listener - document.addEventListener("menubutton", onMenuKeyDown, false); - } - - // Handle the menu button - // - function onMenuKeyDown() { - } - - </script> - </head> - <body onload="onLoad()"> - </body> - </html> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/cordova/events/events.pause.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/cordova/events/events.pause.md b/www/docs/en/dev/cordova/events/events.pause.md deleted file mode 100644 index e46c0b3..0000000 --- a/www/docs/en/dev/cordova/events/events.pause.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -license: > - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - -title: pause ---- - -# pause - -The event fires when an application is put into the background. - - document.addEventListener("pause", yourCallbackFunction, false); - -## Details - -The `pause` event fires when the native platform puts the application -into the background, typically when the user switches to a different -application. - -Applications typically should use `document.addEventListener` to -attach an event listener once the `[deviceready](events.deviceready.html)` event fires. - -## Supported Platforms - -- Amazon Fire OS -- Android -- BlackBerry 10 -- iOS -- Windows Phone 8 -- Windows 8 - -## Quick Example - - document.addEventListener("pause", onPause, false); - - function onPause() { - // Handle the pause event - } - -## Full Example - - <!DOCTYPE html> - <html> - <head> - <title>Pause Example</title> - - <script type="text/javascript" charset="utf-8" src="cordova.js"></script> - <script type="text/javascript" charset="utf-8"> - - // Wait for device API libraries to load - // - function onLoad() { - document.addEventListener("deviceready", onDeviceReady, false); - } - - // device APIs are available - // - function onDeviceReady() { - document.addEventListener("pause", onPause, false); - } - - // Handle the pause event - // - function onPause() { - } - - </script> - </head> - <body onload="onLoad()"> - </body> - </html> - -## iOS Quirks - -In the `pause` handler, any calls to the Cordova API or to native -plugins that go through Objective-C do not work, along with any -interactive calls, such as alerts or `console.log()`. They are only -processed when the app resumes, on the next run loop. - -The iOS-specific `resign` event is available as an alternative to -`pause`, and detects when users enable the __Lock__ button to lock the -device with the app running in the foreground. If the app (and -device) is enabled for multi-tasking, this is paired with a subsequent -`pause` event, but only under iOS 5. In effect, all locked apps in iOS -5 that have multi-tasking enabled are pushed to the background. For -apps to remain running when locked under iOS 5, disable the app's -multi-tasking by setting -[UIApplicationExitsOnSuspend](http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html) -to `YES`. To run when locked on iOS 4, this setting does not matter. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/cordova/events/events.resume.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/cordova/events/events.resume.md b/www/docs/en/dev/cordova/events/events.resume.md deleted file mode 100644 index e10e681..0000000 --- a/www/docs/en/dev/cordova/events/events.resume.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -license: > - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - -title: resume ---- - -# resume - -The event fires when an application is retrieved from the background. - - document.addEventListener("resume", yourCallbackFunction, false); - -## Details - -The `resume` event fires when the native platform pulls the -application out from the background. - -Applications typically should use `document.addEventListener` to -attach an event listener once the `[deviceready](events.deviceready.html)` event fires. - -## Supported Platforms - -- Amazon Fire OS -- Android -- BlackBerry 10 -- iOS -- Windows Phone 8 -- Windows 8 - -## Quick Example - - document.addEventListener("resume", onResume, false); - - function onResume() { - // Handle the resume event - } - -## Full Example - - <!DOCTYPE html> - <html> - <head> - <title>Resume Example</title> - - <script type="text/javascript" charset="utf-8" src="cordova.js"></script> - <script type="text/javascript" charset="utf-8"> - - // Wait for device API libraries to load - // - function onLoad() { - document.addEventListener("deviceready", onDeviceReady, false); - } - - // device APIs are available - // - function onDeviceReady() { - document.addEventListener("resume", onResume, false); - } - - // Handle the resume event - // - function onResume() { - } - - </script> - </head> - <body onload="onLoad()"> - </body> - </html> - -## iOS Quirks - -Any interactive functions called from a `[pause](events.pause.html)` event handler execute -later when the app resumes, as signaled by the `resume` event. These -include alerts, `console.log()`, and any calls from plugins or the -Cordova API, which go through Objective-C. - -- __active__ event - - The iOS-specific `active` event is available as an alternative to -`resume`, and detects when users disable the __Lock__ button to unlock -the device with the app running in the foreground. If the app (and -device) is enabled for multi-tasking, this is paired with a subsequent -`resume` event, but only under iOS 5. In effect, all locked apps in -iOS 5 that have multi-tasking enabled are pushed to the background. -For apps to remain running when locked under iOS 5, disable the app's -multi-tasking by setting [UIApplicationExitsOnSuspend](http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html) -to `YES`. To run when locked on iOS 4, this setting does not matter. - -- __resume__ event - - When called from a `resume` event handler, interactive functions such -as `alert()` need to be wrapped in a `setTimeout()` call with a -timeout value of zero, or else the app hangs. For example: - - document.addEventListener("resume", onResume, false); - function onResume() { - setTimeout(function() { - // TODO: do your thing! - }, 0); - } http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/cordova/events/events.searchbutton.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/cordova/events/events.searchbutton.md b/www/docs/en/dev/cordova/events/events.searchbutton.md deleted file mode 100644 index db62172..0000000 --- a/www/docs/en/dev/cordova/events/events.searchbutton.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -license: > - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - -title: searchbutton ---- - -# searchbutton - -The event fires when the user presses the search button on Android. - - document.addEventListener("searchbutton", yourCallbackFunction, false); - -## Details - -If you need to override the default search button behavior on Android -you can register an event listener for the 'searchbutton' event. - -Applications typically should use `document.addEventListener` to -attach an event listener once the `[deviceready](events.deviceready.html)` event fires. - -## Supported Platforms - -- Android - -## Quick Example - - document.addEventListener("searchbutton", onSearchKeyDown, false); - - function onSearchKeyDown() { - // Handle the search button - } - -## Full Example - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" - "http://www.w3.org/TR/html4/strict.dtd"> - <html> - <head> - <title>Search Button Example</title> - - <script type="text/javascript" charset="utf-8" src="cordova.js"></script> - <script type="text/javascript" charset="utf-8"> - - // Wait for device API libraries to load - // - function onLoad() { - document.addEventListener("deviceready", onDeviceReady, false); - } - - // device APIs are available - // - function onDeviceReady() { - // Register the event listener - document.addEventListener("searchbutton", onSearchKeyDown, false); - } - - // Handle the search button - // - function onSearchKeyDown() { - } - - </script> - </head> - <body onload="onLoad()"> - </body> - </html> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/cordova/events/events.startcallbutton.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/cordova/events/events.startcallbutton.md b/www/docs/en/dev/cordova/events/events.startcallbutton.md deleted file mode 100644 index 9e16896..0000000 --- a/www/docs/en/dev/cordova/events/events.startcallbutton.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -license: > - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - -title: startcallbutton ---- - -# startcallbutton - -The event fires when the user presses the start call button. - - document.addEventListener("startcallbutton", yourCallbackFunction, false); - -## Details - -If you need to override the default start call behavior you can -register an event listener for the `startcallbutton` event. - -Applications typically should use `document.addEventListener` to -attach an event listener once the `[deviceready](events.deviceready.html)` event fires. - -## Supported Platforms - -- BlackBerry 10 - -## Quick Example - - document.addEventListener("startcallbutton", onStartCallKeyDown, false); - - function onStartCallKeyDown() { - // Handle the start call button - } - -## Full Example - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" - "http://www.w3.org/TR/html4/strict.dtd"> - <html> - <head> - <title>Start Call Button Example</title> - - <script type="text/javascript" charset="utf-8" src="cordova.js"></script> - <script type="text/javascript" charset="utf-8"> - - // Wait for device API libraries to load - // - function onLoad() { - document.addEventListener("deviceready", onDeviceReady, false); - } - - // device APIs are available - // - function onDeviceReady() { - // Register the event listener - document.addEventListener("startcallbutton", onStartCallKeyDown, false); - } - - // Handle the start call button - // - function onStartCallKeyDown() { - } - - </script> - </head> - <body onload="onLoad()"> - </body> - </html> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/cordova/events/events.volumedownbutton.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/cordova/events/events.volumedownbutton.md b/www/docs/en/dev/cordova/events/events.volumedownbutton.md deleted file mode 100644 index f738c6e..0000000 --- a/www/docs/en/dev/cordova/events/events.volumedownbutton.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -license: > - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - -title: volumedownbutton ---- - -# volumedownbutton - -The event fires when the user presses the volume down button. - - document.addEventListener("volumedownbutton", yourCallbackFunction, false); - -## Details - -If you need to override the default volume down behavior you can -register an event listener for the `volumedownbutton` event. - -Applications typically should use `document.addEventListener` to -attach an event listener once the `[deviceready](events.deviceready.html)` event fires. - -## Supported Platforms - -- BlackBerry 10 -- Android - -## Quick Example - - document.addEventListener("volumedownbutton", onVolumeDownKeyDown, false); - - function onVolumeDownKeyDown() { - // Handle the volume down button - } - -## Full Example - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" - "http://www.w3.org/TR/html4/strict.dtd"> - <html> - <head> - <title>Volume Down Button Example</title> - - <script type="text/javascript" charset="utf-8" src="cordova.js"></script> - <script type="text/javascript" charset="utf-8"> - - // Wait for device API libraries to load - // - function onLoad() { - document.addEventListener("deviceready", onDeviceReady, false); - } - - // device APIs are available - // - function onDeviceReady() { - // Register the event listener - document.addEventListener("volumedownbutton", onVolumeDownKeyDown, false); - } - - // Handle the volume down button - // - function onVolumeDownKeyDown() { - } - - </script> - </head> - <body onload="onLoad()"> - </body> - </html> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/cordova/events/events.volumeupbutton.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/cordova/events/events.volumeupbutton.md b/www/docs/en/dev/cordova/events/events.volumeupbutton.md deleted file mode 100644 index 5fd3b36..0000000 --- a/www/docs/en/dev/cordova/events/events.volumeupbutton.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -license: > - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - -title: volumeupbutton ---- - -# volumeupbutton - -The event fires when the user presses the volume up button. - - document.addEventListener("volumeupbutton", yourCallbackFunction, false); - -## Details - -If you need to override the default volume up behavior you can -register an event listener for the `volumeupbutton` event. - -Applications typically should use `document.addEventListener` to -attach an event listener once the `[deviceready](events.deviceready.html)` event fires. - -## Supported Platforms - -- BlackBerry 10 -- Android - -## Quick Example - - document.addEventListener("volumeupbutton", onVolumeUpKeyDown, false); - - function onVolumeUpKeyDown() { - // Handle the volume up button - } - -## Full Example - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" - "http://www.w3.org/TR/html4/strict.dtd"> - <html> - <head> - <title>Volume Up Button Example</title> - - <script type="text/javascript" charset="utf-8" src="cordova.js"></script> - <script type="text/javascript" charset="utf-8"> - - // Wait for device API libraries to load - // - function onLoad() { - document.addEventListener("deviceready", onDeviceReady, false); - } - - // device APIs are available - // - function onDeviceReady() { - // Register the event listener - document.addEventListener("volumeupbutton", onVolumeUpKeyDown, false); - } - - // Handle the volume up button - // - function onVolumeUpKeyDown() { - } - - </script> - </head> - <body onload="onLoad()"> - </body> - </html> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/guide/cli/index.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/guide/cli/index.md b/www/docs/en/dev/guide/cli/index.md index a011394..67208e8 100644 --- a/www/docs/en/dev/guide/cli/index.md +++ b/www/docs/en/dev/guide/cli/index.md @@ -231,7 +231,7 @@ development cycle. By default, the `cordova create` script generates a skeletal web-based application whose home page is the project's `www/index.html` file. Edit this application however you want, but any initialization should -be specified as part of the `[deviceready](../../cordova/events/events.deviceready.html)` event handler, referenced by +be specified as part of the [deviceready][DeviceReadyEvent] event handler, referenced by default from `www/js/index.js`. Run the following command to iteratively build the project: @@ -340,7 +340,7 @@ use the CLI to add features to the app: $ cordova plugin add cordova-plugin-device -* Network Connection and Battery [Events](../../cordova/events/events.html): +* Network Connection and Battery: $ cordova plugin add cordova-plugin-network-information $ cordova plugin add cordova-plugin-battery-status @@ -500,7 +500,7 @@ You can also use `merges` to add files not present in the original `www` directory. For example, an app can incorporate a _back button_ graphic into the iOS interface, stored in `merges/ios/img/back_button.png`, while the Android version can -instead capture `[backbutton](../../cordova/events/events.backbutton.html)` events from the corresponding hardware +instead capture [backbutton][BackButtonEvent] events from the corresponding hardware button. ## Help Commands @@ -566,3 +566,5 @@ you're building: $ cordova platform update ios ...etc. +[DeviceReadyEvent]: ../../cordova/events/events.html#link-deviceready +[BackButtonEvent]: ../../cordova/events/events.html#link-backbutton http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/guide/next/index.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/guide/next/index.md b/www/docs/en/dev/guide/next/index.md index 2bdf90d..359127d 100644 --- a/www/docs/en/dev/guide/next/index.md +++ b/www/docs/en/dev/guide/next/index.md @@ -41,7 +41,7 @@ This guide contains the following topics: First and foremost - your Cordova applications should adopt the SPA (Single Page Application) design. Loosely defined, a SPA is a client-side application that is run from one request of a web page. The user loads an initial set of resources (HTML, CSS, and JavaScript) and further updates (showing a new view, loading data) is done via AJAX. SPAs are commonly used for more complex client-side applications. GMail is a great example of this. After you load GMail, mail views, editing, and organization are all done by updating the DOM instead of actually leaving the current page to load a completely new one. -Using a SPA can help you organize your application in a more efficient manner, but it also has specific benefits for Cordova applications. A Cordova application must wait for the [deviceready](../../cordova/events/events.deviceready.html) event to fire before any plugins may be used. If you do not use a SPA, and your user clicks to go from one page to another, you will have to wait for [deviceready](../../cordova/events/events.deviceready.html) to fire again before you make use of a plugin. This is easy to forget as your application gets larger. +Using a SPA can help you organize your application in a more efficient manner, but it also has specific benefits for Cordova applications. A Cordova application must wait for the [deviceready][DeviceReadyEvent] event to fire before any plugins may be used. If you do not use a SPA, and your user clicks to go from one page to another, you will have to wait for [deviceready][DeviceReadyEvent] to fire again before you make use of a plugin. This is easy to forget as your application gets larger. Even if you choose not to use Cordova, creating a mobile application without using a single page architecture will have serious performance implications. This is because navigating between pages will require scripts, assets, etc., to be reloaded. Even if these assets are cached, there will still be performance issues. @@ -218,3 +218,4 @@ This Google Group was the old support forum when Cordova was still called PhoneG Consider finding a local Cordova/PhoneGap meetup group +[DeviceReadyEvent]: ../../cordova/events/events.html#link-deviceready http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/guide/platforms/amazonfireos/config.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/guide/platforms/amazonfireos/config.md b/www/docs/en/dev/guide/platforms/amazonfireos/config.md index 8a99227..320377b 100644 --- a/www/docs/en/dev/guide/platforms/amazonfireos/config.md +++ b/www/docs/en/dev/guide/platforms/amazonfireos/config.md @@ -28,9 +28,9 @@ details preferences that only apply to Amazon Fire OS builds. See [The config.x File](config_ref_index.md.html#The%20config.xml%20File) for information on global configuration options. - `KeepRunning` (boolean, defaults to `true`): Determines whether the - application stays running in the background even after a `[pause](../../../cordova/events/events.pause.html)` + application stays running in the background even after a [pause][PauseEvent] event fires. Setting this to `false` does not kill the app after a - `[pause](../../../cordova/events/events.pause.html)` event, but simply halts execution of code within the cordova + [pause][PauseEvent] event, but simply halts execution of code within the cordova webview while the app is in the background. <preference name="KeepRunning" value="false"/> @@ -82,3 +82,4 @@ File](config_ref_index.md.html#The%20config.xml%20File) for information on globa <preference name="LogLevel" value="VERBOSE"/> +[PauseEvent]: ../../../cordova/events/events.html#link-pause http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/guide/platforms/android/config.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/guide/platforms/android/config.md b/www/docs/en/dev/guide/platforms/android/config.md index 6a120ad..4dc09b5 100644 --- a/www/docs/en/dev/guide/platforms/android/config.md +++ b/www/docs/en/dev/guide/platforms/android/config.md @@ -28,9 +28,9 @@ details preferences that only apply to Android builds. See [The config.xml File](config_ref_index.md.html#The%20config.xml%20File) for information on global configuration options. - `KeepRunning` (boolean, defaults to `true`): Determines whether the - application stays running in the background even after a `[pause](../../../cordova/events/events.pause.html)` + application stays running in the background even after a [pause][PauseEvent] event fires. Setting this to `false` does not kill the app after a - `[pause](../../../cordova/events/events.pause.html)` event, but simply halts execution of code within the cordova + [pause][PauseEvent] event, but simply halts execution of code within the cordova webview while the app is in the background. <preference name="KeepRunning" value="false"/> @@ -123,3 +123,4 @@ File](config_ref_index.md.html#The%20config.xml%20File) for information on globa <preference name="AppendUserAgent" value="My Browser" /> +[PauseEvent]: ../../../cordova/events/events.html#link-pause http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/guide/platforms/android/plugin.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/guide/platforms/android/plugin.md b/www/docs/en/dev/guide/platforms/android/plugin.md index 9cb25db..1faf926 100644 --- a/www/docs/en/dev/guide/platforms/android/plugin.md +++ b/www/docs/en/dev/guide/platforms/android/plugin.md @@ -35,7 +35,7 @@ Android WebView with hooks attached to it. Plugins are represented as class mappings in the `config.xml` file. A plugin consists of at least one Java class that extends the `CordovaPlugin` class, overriding one of its `execute` methods. As best practice, the plugin -should also handle `[pause](../../../cordova/events/events.pause.html)` and `[resume](../../../cordova/events/events.resume.html)` events, along with any message +should also handle [pause][PauseEvent] and [resume][ResumeEvent] events, along with any message passing between plugins. Plugins with long-running requests, background activity such as media playback, listeners, or internal state should implement the `onReset()` method as well. It executes @@ -462,3 +462,6 @@ memory. Enable the "Don't keep activities" setting in the Developer Options menu on your device or emulator to simulate low memory scenarios. If your plugin launches external activities, you should always do some testing with this setting enabled to ensure that you are properly handling low memory scenarios. + +[PauseEvent]: ../../../cordova/events/events.html#link-pause +[ResumeEvent]: ../../../cordova/events/events.html#link-resume http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/guide/platforms/ios/plugin.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/guide/platforms/ios/plugin.md b/www/docs/en/dev/guide/platforms/ios/plugin.md index bb318f5..58d6b7c 100644 --- a/www/docs/en/dev/guide/platforms/ios/plugin.md +++ b/www/docs/en/dev/guide/platforms/ios/plugin.md @@ -203,7 +203,7 @@ success callback is called, it passes in the `echo` parameter. ## iOS Integration The `CDVPlugin` class features other methods that your plugin can -override. For example, you can capture the `[pause](../../../cordova/events/events.pause.html)`, `[resume](../../../cordova/events/events.resume.html)`, app +override. For example, you can capture the [pause][PauseEvent], [resume][ResumeEvent], app terminate and `handleOpenURL` events. See the [CDVPlugin.h][CDVPlugin.h] and [CDVPlugin.m][CDVPlugin.m] classes for guidance. @@ -248,4 +248,6 @@ can attach Safari 8.0 to the app running within the iOS 8 Simulator. [CDVPluginResult.h]: https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Public/CDVPluginResult.h [CDVCommandDelegate.h]: https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Public/CDVCommandDelegate.h [CDVPlugin.h]: https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Public/CDVPlugin.h -[CDVPlugin.m]: https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Public/CDVPlugin.m \ No newline at end of file +[CDVPlugin.m]: https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Public/CDVPlugin.m +[ResumeEvent]: ../../../cordova/events/events.html#link-resume +[PauseEvent]: ../../../cordova/events/events.html#link-pause http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a461a3d5/www/docs/en/dev/guide/platforms/wp8/plugin.md ---------------------------------------------------------------------- diff --git a/www/docs/en/dev/guide/platforms/wp8/plugin.md b/www/docs/en/dev/guide/platforms/wp8/plugin.md index 7153275..d7ab559 100644 --- a/www/docs/en/dev/guide/platforms/wp8/plugin.md +++ b/www/docs/en/dev/guide/platforms/wp8/plugin.md @@ -70,7 +70,7 @@ most of the functionality you need: See the [BaseCommand.cs](https://github.com/apache/cordova-wp8/blob/master/wp8/template/cordovalib/Commands/BaseCommand.cs) class for methods available for the plugin to override. For example, -the plugin can capture '[pause](../../../cordova/events/events.pause.html)' and '[resume](../../../cordova/events/events.resume.html)' events. +the plugin can capture [pause][PauseEvent] and [resume][ResumeEvent] events. ## Namespaces @@ -236,3 +236,6 @@ yourself of errors. calling `exec()`. Doing so allows you to re-use more code and pull unnecessary functionality from the plugin's various native implementations. + +[PauseEvent]: ../../../cordova/events/events.html#link-pause +[ResumeEvent]: ../../../cordova/events/events.html#link-resume --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
