incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filip Maj (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-551) deviceready is fired every time changePage() is called in jQuery Mobile within a single-page app
Date Fri, 20 Apr 2012 15:52:40 GMT
deviceready is fired every time changePage() is called in jQuery Mobile within a single-page
app
------------------------------------------------------------------------------------------------

                 Key: CB-551
                 URL: https://issues.apache.org/jira/browse/CB-551
             Project: Apache Callback
          Issue Type: Bug
          Components: BlackBerry
    Affects Versions: 1.6.0
            Reporter: Filip Maj
            Assignee: Filip Maj
             Fix For: 1.7.0


Taken from http://stackoverflow.com/questions/10173155/deviceready-called-everytime-i-do-a-changepage-in-blackberry

Single page app. When switching view divs, something triggers deviceready to be called again.
Likely something to do with the {{location.href}} changing. Probably shouldn't be happening.

Example code:

{code}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" id="viewport" content="width=device-width,height=device- height,initial-scale=1.0,user-scalable=no">
<script src="cordova-1.6.0.js" type="text/javascript"></script> 
<script type="text/javascript" src="jquery/jquery-1.7.1.min.js"></script>
<link rel="stylesheet" href="jquerymobile/jquery.mobile-1.1.0.min.css" />
<script type="text/javascript" src="jquerymobile/jquery.mobile-1.1.0.min.js"></script>
<script type="text/javascript">

    //---------------------------------------------------------------------
    // Cordova event listeners
    //---------------------------------------------------------------------

   function onDeviceReady() {
    alert("Inside Device Ready");
    }

    // register Cordova event listeners when DOM content loaded
    function init() {
        console.log('init()');
        document.addEventListener("deviceready", onDeviceReady, true); 
    }

</script>
<title>Cordova API Sample</title>
</head>
<body onload="init()">

   <div data-role="page" id="home">
<div data-role="header">
<h1>Here is the index page.</h1>
</div>

<div data-role="content">
<p><center>Below you may transition to our other pages.</center></p>

<a href="#about" data-ajax="false" data-role="button" data-inline="true">About  Me</a>
</div>
</div>

<div data-role="page" id="about">
<div data-role="header">
<h1>About Us</h1>
</div>

<div data-role="content">
<a href="#home" data-ajax="false" data-role="button" data-inline="true">Back Home</a>
</div>
</div>
</body>
</html>
{code}



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message