Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D00861175B for ; Thu, 14 Aug 2014 00:59:27 +0000 (UTC) Received: (qmail 36579 invoked by uid 500); 14 Aug 2014 00:59:27 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 36530 invoked by uid 500); 14 Aug 2014 00:59:27 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 36519 invoked by uid 99); 14 Aug 2014 00:59:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Aug 2014 00:59:27 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [64.202.189.19] (HELO m1plded02-02.prod.mesa1.secureserver.net) (64.202.189.19) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Aug 2014 00:59:21 +0000 Received: from listing-agent.com ([68.178.129.131]) by m1plded02-02.prod.mesa1.secureserver.net with : DED : id eQz01o00R2qERHw01Qz0dK; Wed, 13 Aug 2014 17:59:00 -0700 x-originating-ip: 68.178.129.131 Received: from [192.168.0.2] (cpe-72-182-62-152.austin.res.rr.com [72.182.62.152]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by listing-agent.com (Postfix) with ESMTPSA id DEBE747CEA1 for ; Wed, 13 Aug 2014 17:58:59 -0700 (MST) Message-ID: <53EC0986.1070802@tmbsw.com> Date: Wed, 13 Aug 2014 19:57:42 -0500 From: "Terence M. Bandoian" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: dev@cordova.apache.org Subject: Re: OnDeviceReady with unstable behaviour References: <53EC0801.7080409@tmbsw.com> In-Reply-To: <53EC0801.7080409@tmbsw.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Same on http://cordova.apache.org/docs/en/3.5.0/cordova_events_events.md.html#deviceready. -Terence On 8/13/2014 7:51 PM, Terence M. Bandoian wrote: > From the phonegap 3.5.0 docs: > > > > > Device Ready Example > > > > > > > > > -Terence > > > On 8/13/2014 3:52 PM, Carlos Santana wrote: >> Like Andrew mentioned too late to add the listener. >> >> Where are you putting your cordova.js? If you are loading it from >> then device ready is firing before you attach. >> >> To be on the super safe side attach the listener before you load >> cordova.js in body, to be on the safe side. >> >> >> >> On Wed, Aug 13, 2014 at 2:40 PM, Andrew Grieve >> wrote: >> >>> My guess: Don't wait until onload to register your deviceready >>> listener. >>> >>> >>> On Wed, Aug 13, 2014 at 1:43 PM, Leonardo Martínez >>> >>> wrote: >>> >>>> Hi, >>>> >>>> I am new here and I got into this mailing list because of this strange >>>> behaviour. >>>> >>>> The thing is that sometimes the ondeviceready event is not >>>> triggerred and >>>> sometimes it is. I could say like the first time the windows is opened >>>> (window.open("...") ) it is not triggered but going back (to another >>>> window) and in again it's triggered. >>>> >>>> I have this in the HTML: >>>> >>>> >>>>
>>>> >>>> >>>> .... >>>> >>>> >>>> And this function in JS: >>>> >>>> function onLoad() { >>>> document.addEventListener("deviceready", onDeviceReady, false); >>>> alert("I was set"); >>>> } >>>> >>>> function onDeviceReady() { >>>> alert("Hi"); >>>> } >>>> >>>> >>>> I am working with Cordova 3.5.0-0.2.4 and this is happening in iOS. >>>> Not >>> on >>>> Android with the same code. >>>> >>>> Hope you can help me. Thanks! >>>> >>>> -- >>>> Leonardo. >>>> >> >> >