cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rakatyal <...@git.apache.org>
Subject [GitHub] cordova-docs pull request: CB-10351: Make Events page a reference
Date Tue, 02 Feb 2016 22:28:22 GMT
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/480#discussion_r51646921
  
    --- Diff: www/docs/en/dev/cordova/events/events.md ---
    @@ -22,29 +22,561 @@ title: Events
     
     # Events
     
    -> Cordova lifecycle events.
    +<!-- START HTML -->
     
    -## Event Types
    +<table class="compat" width="100%">
     
    -- [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)
    +<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>
     
    -## Events added by [cordova-plugin-battery-status](https://github.com/apache/cordova-plugin-battery-status/blob/master/README.md)
    +<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>
     
    -- batterycritical
    -- batterylow
    -- batterystatus
    +    <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>
     
    -## Events added by [cordova-plugin-network-information](https://github.com/apache/cordova-plugin-network-information/blob/master/README.md)
    +    <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>
     
    -- online
    -- offline
    +    <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 -->
    +
    +
    +**Note**: Applications typically should use `document.addEventListener` to
    +attach an event listener once the [deviceready](#link-deviceready) 
    +event fires.
    +
    +## 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
    +    }
    +
    +### Full Example
    +
    +**Note**: For the sake of readability, all the other events assume that you use the
    +below html code.
    +
    +#### HTML File
    +
    +    <!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" src="example.js"></script>
    +      </head>
    +      <body onload="onLoad()">
    +      </body>
    +    </html>
    +
    +#### JS File
    +    // example.js file
    +    // 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
    +    }
    +
    +## pause
    +
    +The pause event fires when an application is put into the background. The `pause` 
    --- End diff --
    
    I meant the description of 'pause' event. We can probably make it a single line.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message