You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Leonardo Martínez <le...@gmail.com> on 2014/08/13 19:43:24 UTC

OnDeviceReady with unstable behaviour

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:

<body onload="onLoad()">
        <div id="mainDiv">
            <div id="deviceready" class="blink">
                <p class="event listening">Connecting to Device</p>
                <p class="event received">Device is Ready</p>
            </div>

....
</body>

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.

Re: OnDeviceReady with unstable behaviour

Posted by Ian Clelland <ic...@chromium.org>.
On Friday, August 15, 2014, Leonardo Martínez <le...@gmail.com> wrote:

> Hi,
>
> Thanks for your help. I have tried to simplify the code to just test the
> ondeviceready event. The funny thing is that the problem is not happening
> anymore...
>
> I have removed all of the plugins (some custom that I have created and core
> ones too). Could the plugins cause a problem to the device ready event?
> What do you think?


It's possible, but I think it's unlikely that the problem is *just* in a
plugin. I think that messing with the deviceready event would stand out as
a pretty obvious bug.

It's more likely that this is a regression in cordova, possibly
timing-dependant, and the specific plugins you had installed were just
making the but apparent.

>
> I had attached the simple test project I have created but it was exceeding
> the allowed size for an email...


This mailing list isn't going to allow attachments anyway, just like it
blocks images. Better to attach the project to the issue, or upload it
somewhere like Dropbox and post the link.

Ian

>
>
> On Fri, Aug 15, 2014 at 2:07 PM, Leonardo Martínez <leolib2004@gmail.com
> <javascript:;>>
> wrote:
>
> > Hi,
> >
> > Thanks for your help. I have tried to simplify the code to just test the
> > ondeviceready event. The funny thing is that the problem is not happening
> > anymore...
> >
> > I have removed all of the plugins (some custom that I have created and
> > core ones too). Could the plugins cause a problem to the device ready
> > event? What do you think?
> >
> > I have attached the simple test project I have created.
> >
> >
> > On Fri, Aug 15, 2014 at 11:03 AM, Michal Mocny <mmocny@chromium.org
> <javascript:;>>
> > wrote:
> >
> >> If we can change email settings, can we also allow html, to allow inline
> >> links?
> >>
> >>
> >> On Fri, Aug 15, 2014 at 2:01 PM, Carlos Santana <csantana23@gmail.com
> <javascript:;>>
> >> wrote:
> >>
> >> > hehe sorry Jesse, didn't know you sent it.
> >> >
> >> > I don't think email settings can be change, but we can ask infra
> >> >
> >> >
> >> > On Fri, Aug 15, 2014 at 1:55 PM, Jesse <purplecabbage@gmail.com
> <javascript:;>> wrote:
> >> >
> >> > > That is almost exactly the same image as mine! I ended up sending it
> >> > > directly to Leonardo, and didn't update the list.
> >> > > Should we change the email settings?
> >> > >
> >> > > @purplecabbage
> >> > > risingj.com
> >> > >
> >> > >
> >> > > On Fri, Aug 15, 2014 at 7:04 AM, Carlos Santana <
> csantana23@gmail.com <javascript:;>
> >> >
> >> > > wrote:
> >> > >
> >> > > > stupid mailing list doesn't allow images, Feeling ->"punch me in
> the
> >> > face
> >> > > > now"
> >> > > >
> >> > > > here is an image:
> >> > > >
> >> > > > http://bit.ly/1m1CLOT
> >> > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > On Thu, Aug 14, 2014 at 7:09 PM, Leonardo Martínez <
> >> > leolib2004@gmail.com <javascript:;>
> >> > > >
> >> > > > wrote:
> >> > > >
> >> > > > > I can't find the more dropdown and I can't see the image
> either...
> >> > > > >
> >> > > > >
> >> > > > > On Thu, Aug 14, 2014 at 4:03 PM, Jesse <purplecabbage@gmail.com
> <javascript:;>>
> >> > > wrote:
> >> > > > >
> >> > > > > > 'More' dropdown -> attach files
> >> > > > > >
> >> > > > > > [image: Inline image 1]
> >> > > > > >
> >> > > > > > @purplecabbage
> >> > > > > > risingj.com
> >> > > > > >
> >> > > > > >
> >> > > > > > On Thu, Aug 14, 2014 at 3:55 PM, Leonardo Martínez <
> >> > > > leolib2004@gmail.com <javascript:;>
> >> > > > > >
> >> > > > > > wrote:
> >> > > > > >
> >> > > > > >> Thanks guys.  How do I add a cordova project into the issue?
> I
> >> > > signed
> >> > > > up
> >> > > > > >> but I don't see how to add that...
> >> > > > > >>
> >> > > > > >>
> >> > > > > >> On Thu, Aug 14, 2014 at 8:09 AM, Carlos Santana <
> >> > > csantana23@gmail.com <javascript:;>
> >> > > > >
> >> > > > > >> wrote:
> >> > > > > >>
> >> > > > > >> > Leonard open a JIRA [1] item, with a simple cordova project
> >> to
> >> > > > > recreate
> >> > > > > >> > problem.
> >> > > > > >> >
> >> > > > > >> > Maybe with more details someone can take a look and help.
> >> > > > > >> >
> >> > > > > >> > [1]: https://issues.apache.org/jira/browse/CB
> >> > > > > >> >
> >> > > > > >> >
> >> > > > > >> >
> >> > > > > >> > On Thu, Aug 14, 2014 at 10:09 AM, Andrew Grieve <
> >> > > > agrieve@chromium.org <javascript:;>
> >> > > > > >
> >> > > > > >> > wrote:
> >> > > > > >> >
> >> > > > > >> > > Hmm, good point. I have no guesses now :(
> >> > > > > >> > >
> >> > > > > >> > >
> >> > > > > >> > > On Wed, Aug 13, 2014 at 10:25 PM, Terence M. Bandoian <
> >> > > > > >> terence@tmbsw.com <javascript:;>
> >> > > > > >> > >
> >> > > > > >> > > wrote:
> >> > > > > >> > >
> >> > > > > >> > > > Right. The docs also include the following:
> >> > > > > >> > > >
> >> > > > > >> > > > "The deviceready event behaves somewhat differently
> from
> >> > > others.
> >> > > > > Any
> >> > > > > >> > > event
> >> > > > > >> > > > handler registered after the deviceready event fires
> has
> >> its
> >> > > > > >> callback
> >> > > > > >> > > > function called immediately."
> >> > > > > >> > > >
> >> > > > > >> > > > -Terence
> >> > > > > >> > > >
> >> > > > > >> > > >
> >> > > > > >> > > >
> >> > > > > >> > > > On 8/13/2014 8:29 PM, Joe Bowser wrote:
> >> > > > > >> > > >
> >> > > > > >> > > >> When subscribing to the events, it should actually run
> >> > right
> >> > > > away
> >> > > > > >> if
> >> > > > > >> > the
> >> > > > > >> > > >> event was already fired. This is definitely a
> >> regression in
> >> > > > > >> > cordova.js,
> >> > > > > >> > > or
> >> > > > > >> > > >> a design change I didn't catch. Both are possible.
> >> > > > > >> > > >> On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <
> >> > > > > terence@tmbsw.com <javascript:;>>
> >> > > > > >> > > wrote:
> >> > > > > >> > > >>
> >> > > > > >> > > >>  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:
> >> > > > > >> > > >>>>
> >> > > > > >> > > >>>> <!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>
> >> > > > > >> > > >>>>
> >> > > > > >> > > >>>> -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
> >> > > > > >> > > >>>>> <head>
> >> > > > > >> > > >>>>> 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 <
> >> > > > > >> > agrieve@chromium.org <javascript:;>
> >> > > > > >> > > >
> >> > > > > >> > > >>>>> 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 <
> >> > > > > >> > > >>>>>> leolib2004@gmail.com <javascript:;>>
> >> > > > > >> > > >>>>>> 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:
> >> > > > > >> > > >>>>>>>
> >> > > > > >> > > >>>>>>> <body onload="onLoad()">
> >> > > > > >> > > >>>>>>>           <div id="mainDiv">
> >> > > > > >> > > >>>>>>>               <div id="deviceready"
> class="blink">
> >> > > > > >> > > >>>>>>>                   <p class="event
> >> > listening">Connecting
> >> > > to
> >> > > > > >> > > Device</p>
> >> > > > > >> > > >>>>>>>                   <p class="event
> received">Device
> >> is
> >> > > > > >> Ready</p>
> >> > > > > >> > > >>>>>>>               </div>
> >> > > > > >> > > >>>>>>>
> >> > > > > >> > > >>>>>>> ....
> >> > > > > >> > > >>>>>>> </body>
> >> > > > > >> > > >>>>>>>
> >> > > > > >> > > >>>>>>> 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.
> >> > > > > >> > > >>>>>>>
> >> > > > > >> > > >>>>>>>
> >> > > > > >> > > >>>>>>>
> >> > > > > >> > > >>>>>
> >> > > > > >> > > >
> >> > > > > >> > >
> >> > > > > >> >
> >> > > > > >> >
> >> > > > > >> >
> >> > > > > >> > --
> >> > > > > >> > Carlos Santana
> >> > > > > >> > <csantana23@gmail.com <javascript:;>>
> >> > > > > >> >
> >> > > > > >>
> >> > > > > >>
> >> > > > > >>
> >> > > > > >> --
> >> > > > > >> Leonardo.
> >> > > > > >>
> >> > > > > >
> >> > > > > >
> >> > > > >
> >> > > > >
> >> > > > > --
> >> > > > > Leonardo.
> >> > > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > --
> >> > > > Carlos Santana
> >> > > > <csantana23@gmail.com <javascript:;>>
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > Carlos Santana
> >> > <csantana23@gmail.com <javascript:;>>
> >> >
> >>
> >
> >
> >
> > --
> > Leonardo.
> >
>
>
>
> --
> Leonardo.
>

Re: OnDeviceReady with unstable behaviour

Posted by Eduardo Schettino <sc...@gmail.com>.
On Sat, Aug 16, 2014 at 5:26 AM, Leonardo Martínez <le...@gmail.com>
wrote:

> Hi,
>
> Thanks for your help. I have tried to simplify the code to just test the
> ondeviceready event. The funny thing is that the problem is not happening
> anymore...
>
> I have removed all of the plugins (some custom that I have created and core
> ones too). Could the plugins cause a problem to the device ready event?
> What do you think?
>
> I had attached the simple test project I have created but it was exceeding
> the allowed size for an email...
>
>
Hi Leonardo,

Did you create an issue in the tracker? I couldn't find it.
Can you easily reproduce the problem with your full project?

I also noticed the unstable behaviour but it was very seldom.
Then somehow it stopped before I got the chance to debug it.
And this was using android...

cheers,
  Eduardo

Re: OnDeviceReady with unstable behaviour

Posted by Leonardo Martínez <le...@gmail.com>.
Hi,

Thanks for your help. I have tried to simplify the code to just test the
ondeviceready event. The funny thing is that the problem is not happening
anymore...

I have removed all of the plugins (some custom that I have created and core
ones too). Could the plugins cause a problem to the device ready event?
What do you think?

I had attached the simple test project I have created but it was exceeding
the allowed size for an email...


On Fri, Aug 15, 2014 at 2:07 PM, Leonardo Martínez <le...@gmail.com>
wrote:

> Hi,
>
> Thanks for your help. I have tried to simplify the code to just test the
> ondeviceready event. The funny thing is that the problem is not happening
> anymore...
>
> I have removed all of the plugins (some custom that I have created and
> core ones too). Could the plugins cause a problem to the device ready
> event? What do you think?
>
> I have attached the simple test project I have created.
>
>
> On Fri, Aug 15, 2014 at 11:03 AM, Michal Mocny <mm...@chromium.org>
> wrote:
>
>> If we can change email settings, can we also allow html, to allow inline
>> links?
>>
>>
>> On Fri, Aug 15, 2014 at 2:01 PM, Carlos Santana <cs...@gmail.com>
>> wrote:
>>
>> > hehe sorry Jesse, didn't know you sent it.
>> >
>> > I don't think email settings can be change, but we can ask infra
>> >
>> >
>> > On Fri, Aug 15, 2014 at 1:55 PM, Jesse <pu...@gmail.com> wrote:
>> >
>> > > That is almost exactly the same image as mine! I ended up sending it
>> > > directly to Leonardo, and didn't update the list.
>> > > Should we change the email settings?
>> > >
>> > > @purplecabbage
>> > > risingj.com
>> > >
>> > >
>> > > On Fri, Aug 15, 2014 at 7:04 AM, Carlos Santana <csantana23@gmail.com
>> >
>> > > wrote:
>> > >
>> > > > stupid mailing list doesn't allow images, Feeling ->"punch me in the
>> > face
>> > > > now"
>> > > >
>> > > > here is an image:
>> > > >
>> > > > http://bit.ly/1m1CLOT
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > On Thu, Aug 14, 2014 at 7:09 PM, Leonardo Martínez <
>> > leolib2004@gmail.com
>> > > >
>> > > > wrote:
>> > > >
>> > > > > I can't find the more dropdown and I can't see the image either...
>> > > > >
>> > > > >
>> > > > > On Thu, Aug 14, 2014 at 4:03 PM, Jesse <pu...@gmail.com>
>> > > wrote:
>> > > > >
>> > > > > > 'More' dropdown -> attach files
>> > > > > >
>> > > > > > [image: Inline image 1]
>> > > > > >
>> > > > > > @purplecabbage
>> > > > > > risingj.com
>> > > > > >
>> > > > > >
>> > > > > > On Thu, Aug 14, 2014 at 3:55 PM, Leonardo Martínez <
>> > > > leolib2004@gmail.com
>> > > > > >
>> > > > > > wrote:
>> > > > > >
>> > > > > >> Thanks guys.  How do I add a cordova project into the issue? I
>> > > signed
>> > > > up
>> > > > > >> but I don't see how to add that...
>> > > > > >>
>> > > > > >>
>> > > > > >> On Thu, Aug 14, 2014 at 8:09 AM, Carlos Santana <
>> > > csantana23@gmail.com
>> > > > >
>> > > > > >> wrote:
>> > > > > >>
>> > > > > >> > Leonard open a JIRA [1] item, with a simple cordova project
>> to
>> > > > > recreate
>> > > > > >> > problem.
>> > > > > >> >
>> > > > > >> > Maybe with more details someone can take a look and help.
>> > > > > >> >
>> > > > > >> > [1]: https://issues.apache.org/jira/browse/CB
>> > > > > >> >
>> > > > > >> >
>> > > > > >> >
>> > > > > >> > On Thu, Aug 14, 2014 at 10:09 AM, Andrew Grieve <
>> > > > agrieve@chromium.org
>> > > > > >
>> > > > > >> > wrote:
>> > > > > >> >
>> > > > > >> > > Hmm, good point. I have no guesses now :(
>> > > > > >> > >
>> > > > > >> > >
>> > > > > >> > > On Wed, Aug 13, 2014 at 10:25 PM, Terence M. Bandoian <
>> > > > > >> terence@tmbsw.com
>> > > > > >> > >
>> > > > > >> > > wrote:
>> > > > > >> > >
>> > > > > >> > > > Right. The docs also include the following:
>> > > > > >> > > >
>> > > > > >> > > > "The deviceready event behaves somewhat differently from
>> > > others.
>> > > > > Any
>> > > > > >> > > event
>> > > > > >> > > > handler registered after the deviceready event fires has
>> its
>> > > > > >> callback
>> > > > > >> > > > function called immediately."
>> > > > > >> > > >
>> > > > > >> > > > -Terence
>> > > > > >> > > >
>> > > > > >> > > >
>> > > > > >> > > >
>> > > > > >> > > > On 8/13/2014 8:29 PM, Joe Bowser wrote:
>> > > > > >> > > >
>> > > > > >> > > >> When subscribing to the events, it should actually run
>> > right
>> > > > away
>> > > > > >> if
>> > > > > >> > the
>> > > > > >> > > >> event was already fired. This is definitely a
>> regression in
>> > > > > >> > cordova.js,
>> > > > > >> > > or
>> > > > > >> > > >> a design change I didn't catch. Both are possible.
>> > > > > >> > > >> On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <
>> > > > > terence@tmbsw.com>
>> > > > > >> > > wrote:
>> > > > > >> > > >>
>> > > > > >> > > >>  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:
>> > > > > >> > > >>>>
>> > > > > >> > > >>>> <!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>
>> > > > > >> > > >>>>
>> > > > > >> > > >>>> -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
>> > > > > >> > > >>>>> <head>
>> > > > > >> > > >>>>> 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 <
>> > > > > >> > agrieve@chromium.org
>> > > > > >> > > >
>> > > > > >> > > >>>>> 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 <
>> > > > > >> > > >>>>>> leolib2004@gmail.com>
>> > > > > >> > > >>>>>> 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:
>> > > > > >> > > >>>>>>>
>> > > > > >> > > >>>>>>> <body onload="onLoad()">
>> > > > > >> > > >>>>>>>           <div id="mainDiv">
>> > > > > >> > > >>>>>>>               <div id="deviceready" class="blink">
>> > > > > >> > > >>>>>>>                   <p class="event
>> > listening">Connecting
>> > > to
>> > > > > >> > > Device</p>
>> > > > > >> > > >>>>>>>                   <p class="event received">Device
>> is
>> > > > > >> Ready</p>
>> > > > > >> > > >>>>>>>               </div>
>> > > > > >> > > >>>>>>>
>> > > > > >> > > >>>>>>> ....
>> > > > > >> > > >>>>>>> </body>
>> > > > > >> > > >>>>>>>
>> > > > > >> > > >>>>>>> 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.
>> > > > > >> > > >>>>>>>
>> > > > > >> > > >>>>>>>
>> > > > > >> > > >>>>>>>
>> > > > > >> > > >>>>>
>> > > > > >> > > >
>> > > > > >> > >
>> > > > > >> >
>> > > > > >> >
>> > > > > >> >
>> > > > > >> > --
>> > > > > >> > Carlos Santana
>> > > > > >> > <cs...@gmail.com>
>> > > > > >> >
>> > > > > >>
>> > > > > >>
>> > > > > >>
>> > > > > >> --
>> > > > > >> Leonardo.
>> > > > > >>
>> > > > > >
>> > > > > >
>> > > > >
>> > > > >
>> > > > > --
>> > > > > Leonardo.
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > Carlos Santana
>> > > > <cs...@gmail.com>
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> > Carlos Santana
>> > <cs...@gmail.com>
>> >
>>
>
>
>
> --
> Leonardo.
>



-- 
Leonardo.

Re: OnDeviceReady with unstable behaviour

Posted by Michal Mocny <mm...@chromium.org>.
If we can change email settings, can we also allow html, to allow inline
links?


On Fri, Aug 15, 2014 at 2:01 PM, Carlos Santana <cs...@gmail.com>
wrote:

> hehe sorry Jesse, didn't know you sent it.
>
> I don't think email settings can be change, but we can ask infra
>
>
> On Fri, Aug 15, 2014 at 1:55 PM, Jesse <pu...@gmail.com> wrote:
>
> > That is almost exactly the same image as mine! I ended up sending it
> > directly to Leonardo, and didn't update the list.
> > Should we change the email settings?
> >
> > @purplecabbage
> > risingj.com
> >
> >
> > On Fri, Aug 15, 2014 at 7:04 AM, Carlos Santana <cs...@gmail.com>
> > wrote:
> >
> > > stupid mailing list doesn't allow images, Feeling ->"punch me in the
> face
> > > now"
> > >
> > > here is an image:
> > >
> > > http://bit.ly/1m1CLOT
> > >
> > >
> > >
> > >
> > > On Thu, Aug 14, 2014 at 7:09 PM, Leonardo Martínez <
> leolib2004@gmail.com
> > >
> > > wrote:
> > >
> > > > I can't find the more dropdown and I can't see the image either...
> > > >
> > > >
> > > > On Thu, Aug 14, 2014 at 4:03 PM, Jesse <pu...@gmail.com>
> > wrote:
> > > >
> > > > > 'More' dropdown -> attach files
> > > > >
> > > > > [image: Inline image 1]
> > > > >
> > > > > @purplecabbage
> > > > > risingj.com
> > > > >
> > > > >
> > > > > On Thu, Aug 14, 2014 at 3:55 PM, Leonardo Martínez <
> > > leolib2004@gmail.com
> > > > >
> > > > > wrote:
> > > > >
> > > > >> Thanks guys.  How do I add a cordova project into the issue? I
> > signed
> > > up
> > > > >> but I don't see how to add that...
> > > > >>
> > > > >>
> > > > >> On Thu, Aug 14, 2014 at 8:09 AM, Carlos Santana <
> > csantana23@gmail.com
> > > >
> > > > >> wrote:
> > > > >>
> > > > >> > Leonard open a JIRA [1] item, with a simple cordova project to
> > > > recreate
> > > > >> > problem.
> > > > >> >
> > > > >> > Maybe with more details someone can take a look and help.
> > > > >> >
> > > > >> > [1]: https://issues.apache.org/jira/browse/CB
> > > > >> >
> > > > >> >
> > > > >> >
> > > > >> > On Thu, Aug 14, 2014 at 10:09 AM, Andrew Grieve <
> > > agrieve@chromium.org
> > > > >
> > > > >> > wrote:
> > > > >> >
> > > > >> > > Hmm, good point. I have no guesses now :(
> > > > >> > >
> > > > >> > >
> > > > >> > > On Wed, Aug 13, 2014 at 10:25 PM, Terence M. Bandoian <
> > > > >> terence@tmbsw.com
> > > > >> > >
> > > > >> > > wrote:
> > > > >> > >
> > > > >> > > > Right. The docs also include the following:
> > > > >> > > >
> > > > >> > > > "The deviceready event behaves somewhat differently from
> > others.
> > > > Any
> > > > >> > > event
> > > > >> > > > handler registered after the deviceready event fires has its
> > > > >> callback
> > > > >> > > > function called immediately."
> > > > >> > > >
> > > > >> > > > -Terence
> > > > >> > > >
> > > > >> > > >
> > > > >> > > >
> > > > >> > > > On 8/13/2014 8:29 PM, Joe Bowser wrote:
> > > > >> > > >
> > > > >> > > >> When subscribing to the events, it should actually run
> right
> > > away
> > > > >> if
> > > > >> > the
> > > > >> > > >> event was already fired. This is definitely a regression in
> > > > >> > cordova.js,
> > > > >> > > or
> > > > >> > > >> a design change I didn't catch. Both are possible.
> > > > >> > > >> On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <
> > > > terence@tmbsw.com>
> > > > >> > > wrote:
> > > > >> > > >>
> > > > >> > > >>  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:
> > > > >> > > >>>>
> > > > >> > > >>>> <!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>
> > > > >> > > >>>>
> > > > >> > > >>>> -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
> > > > >> > > >>>>> <head>
> > > > >> > > >>>>> 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 <
> > > > >> > agrieve@chromium.org
> > > > >> > > >
> > > > >> > > >>>>> 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 <
> > > > >> > > >>>>>> leolib2004@gmail.com>
> > > > >> > > >>>>>> 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:
> > > > >> > > >>>>>>>
> > > > >> > > >>>>>>> <body onload="onLoad()">
> > > > >> > > >>>>>>>           <div id="mainDiv">
> > > > >> > > >>>>>>>               <div id="deviceready" class="blink">
> > > > >> > > >>>>>>>                   <p class="event
> listening">Connecting
> > to
> > > > >> > > Device</p>
> > > > >> > > >>>>>>>                   <p class="event received">Device is
> > > > >> Ready</p>
> > > > >> > > >>>>>>>               </div>
> > > > >> > > >>>>>>>
> > > > >> > > >>>>>>> ....
> > > > >> > > >>>>>>> </body>
> > > > >> > > >>>>>>>
> > > > >> > > >>>>>>> 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.
> > > > >> > > >>>>>>>
> > > > >> > > >>>>>>>
> > > > >> > > >>>>>>>
> > > > >> > > >>>>>
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >> >
> > > > >> >
> > > > >> > --
> > > > >> > Carlos Santana
> > > > >> > <cs...@gmail.com>
> > > > >> >
> > > > >>
> > > > >>
> > > > >>
> > > > >> --
> > > > >> Leonardo.
> > > > >>
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Leonardo.
> > > >
> > >
> > >
> > >
> > > --
> > > Carlos Santana
> > > <cs...@gmail.com>
> > >
> >
>
>
>
> --
> Carlos Santana
> <cs...@gmail.com>
>

Re: OnDeviceReady with unstable behaviour

Posted by Carlos Santana <cs...@gmail.com>.
hehe sorry Jesse, didn't know you sent it.

I don't think email settings can be change, but we can ask infra


On Fri, Aug 15, 2014 at 1:55 PM, Jesse <pu...@gmail.com> wrote:

> That is almost exactly the same image as mine! I ended up sending it
> directly to Leonardo, and didn't update the list.
> Should we change the email settings?
>
> @purplecabbage
> risingj.com
>
>
> On Fri, Aug 15, 2014 at 7:04 AM, Carlos Santana <cs...@gmail.com>
> wrote:
>
> > stupid mailing list doesn't allow images, Feeling ->"punch me in the face
> > now"
> >
> > here is an image:
> >
> > http://bit.ly/1m1CLOT
> >
> >
> >
> >
> > On Thu, Aug 14, 2014 at 7:09 PM, Leonardo Martínez <leolib2004@gmail.com
> >
> > wrote:
> >
> > > I can't find the more dropdown and I can't see the image either...
> > >
> > >
> > > On Thu, Aug 14, 2014 at 4:03 PM, Jesse <pu...@gmail.com>
> wrote:
> > >
> > > > 'More' dropdown -> attach files
> > > >
> > > > [image: Inline image 1]
> > > >
> > > > @purplecabbage
> > > > risingj.com
> > > >
> > > >
> > > > On Thu, Aug 14, 2014 at 3:55 PM, Leonardo Martínez <
> > leolib2004@gmail.com
> > > >
> > > > wrote:
> > > >
> > > >> Thanks guys.  How do I add a cordova project into the issue? I
> signed
> > up
> > > >> but I don't see how to add that...
> > > >>
> > > >>
> > > >> On Thu, Aug 14, 2014 at 8:09 AM, Carlos Santana <
> csantana23@gmail.com
> > >
> > > >> wrote:
> > > >>
> > > >> > Leonard open a JIRA [1] item, with a simple cordova project to
> > > recreate
> > > >> > problem.
> > > >> >
> > > >> > Maybe with more details someone can take a look and help.
> > > >> >
> > > >> > [1]: https://issues.apache.org/jira/browse/CB
> > > >> >
> > > >> >
> > > >> >
> > > >> > On Thu, Aug 14, 2014 at 10:09 AM, Andrew Grieve <
> > agrieve@chromium.org
> > > >
> > > >> > wrote:
> > > >> >
> > > >> > > Hmm, good point. I have no guesses now :(
> > > >> > >
> > > >> > >
> > > >> > > On Wed, Aug 13, 2014 at 10:25 PM, Terence M. Bandoian <
> > > >> terence@tmbsw.com
> > > >> > >
> > > >> > > wrote:
> > > >> > >
> > > >> > > > Right. The docs also include the following:
> > > >> > > >
> > > >> > > > "The deviceready event behaves somewhat differently from
> others.
> > > Any
> > > >> > > event
> > > >> > > > handler registered after the deviceready event fires has its
> > > >> callback
> > > >> > > > function called immediately."
> > > >> > > >
> > > >> > > > -Terence
> > > >> > > >
> > > >> > > >
> > > >> > > >
> > > >> > > > On 8/13/2014 8:29 PM, Joe Bowser wrote:
> > > >> > > >
> > > >> > > >> When subscribing to the events, it should actually run right
> > away
> > > >> if
> > > >> > the
> > > >> > > >> event was already fired. This is definitely a regression in
> > > >> > cordova.js,
> > > >> > > or
> > > >> > > >> a design change I didn't catch. Both are possible.
> > > >> > > >> On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <
> > > terence@tmbsw.com>
> > > >> > > wrote:
> > > >> > > >>
> > > >> > > >>  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:
> > > >> > > >>>>
> > > >> > > >>>> <!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>
> > > >> > > >>>>
> > > >> > > >>>> -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
> > > >> > > >>>>> <head>
> > > >> > > >>>>> 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 <
> > > >> > agrieve@chromium.org
> > > >> > > >
> > > >> > > >>>>> 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 <
> > > >> > > >>>>>> leolib2004@gmail.com>
> > > >> > > >>>>>> 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:
> > > >> > > >>>>>>>
> > > >> > > >>>>>>> <body onload="onLoad()">
> > > >> > > >>>>>>>           <div id="mainDiv">
> > > >> > > >>>>>>>               <div id="deviceready" class="blink">
> > > >> > > >>>>>>>                   <p class="event listening">Connecting
> to
> > > >> > > Device</p>
> > > >> > > >>>>>>>                   <p class="event received">Device is
> > > >> Ready</p>
> > > >> > > >>>>>>>               </div>
> > > >> > > >>>>>>>
> > > >> > > >>>>>>> ....
> > > >> > > >>>>>>> </body>
> > > >> > > >>>>>>>
> > > >> > > >>>>>>> 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.
> > > >> > > >>>>>>>
> > > >> > > >>>>>>>
> > > >> > > >>>>>>>
> > > >> > > >>>>>
> > > >> > > >
> > > >> > >
> > > >> >
> > > >> >
> > > >> >
> > > >> > --
> > > >> > Carlos Santana
> > > >> > <cs...@gmail.com>
> > > >> >
> > > >>
> > > >>
> > > >>
> > > >> --
> > > >> Leonardo.
> > > >>
> > > >
> > > >
> > >
> > >
> > > --
> > > Leonardo.
> > >
> >
> >
> >
> > --
> > Carlos Santana
> > <cs...@gmail.com>
> >
>



-- 
Carlos Santana
<cs...@gmail.com>

Re: OnDeviceReady with unstable behaviour

Posted by Jesse <pu...@gmail.com>.
That is almost exactly the same image as mine! I ended up sending it
directly to Leonardo, and didn't update the list.
Should we change the email settings?

@purplecabbage
risingj.com


On Fri, Aug 15, 2014 at 7:04 AM, Carlos Santana <cs...@gmail.com>
wrote:

> stupid mailing list doesn't allow images, Feeling ->"punch me in the face
> now"
>
> here is an image:
>
> http://bit.ly/1m1CLOT
>
>
>
>
> On Thu, Aug 14, 2014 at 7:09 PM, Leonardo Martínez <le...@gmail.com>
> wrote:
>
> > I can't find the more dropdown and I can't see the image either...
> >
> >
> > On Thu, Aug 14, 2014 at 4:03 PM, Jesse <pu...@gmail.com> wrote:
> >
> > > 'More' dropdown -> attach files
> > >
> > > [image: Inline image 1]
> > >
> > > @purplecabbage
> > > risingj.com
> > >
> > >
> > > On Thu, Aug 14, 2014 at 3:55 PM, Leonardo Martínez <
> leolib2004@gmail.com
> > >
> > > wrote:
> > >
> > >> Thanks guys.  How do I add a cordova project into the issue? I signed
> up
> > >> but I don't see how to add that...
> > >>
> > >>
> > >> On Thu, Aug 14, 2014 at 8:09 AM, Carlos Santana <csantana23@gmail.com
> >
> > >> wrote:
> > >>
> > >> > Leonard open a JIRA [1] item, with a simple cordova project to
> > recreate
> > >> > problem.
> > >> >
> > >> > Maybe with more details someone can take a look and help.
> > >> >
> > >> > [1]: https://issues.apache.org/jira/browse/CB
> > >> >
> > >> >
> > >> >
> > >> > On Thu, Aug 14, 2014 at 10:09 AM, Andrew Grieve <
> agrieve@chromium.org
> > >
> > >> > wrote:
> > >> >
> > >> > > Hmm, good point. I have no guesses now :(
> > >> > >
> > >> > >
> > >> > > On Wed, Aug 13, 2014 at 10:25 PM, Terence M. Bandoian <
> > >> terence@tmbsw.com
> > >> > >
> > >> > > wrote:
> > >> > >
> > >> > > > Right. The docs also include the following:
> > >> > > >
> > >> > > > "The deviceready event behaves somewhat differently from others.
> > Any
> > >> > > event
> > >> > > > handler registered after the deviceready event fires has its
> > >> callback
> > >> > > > function called immediately."
> > >> > > >
> > >> > > > -Terence
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > On 8/13/2014 8:29 PM, Joe Bowser wrote:
> > >> > > >
> > >> > > >> When subscribing to the events, it should actually run right
> away
> > >> if
> > >> > the
> > >> > > >> event was already fired. This is definitely a regression in
> > >> > cordova.js,
> > >> > > or
> > >> > > >> a design change I didn't catch. Both are possible.
> > >> > > >> On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <
> > terence@tmbsw.com>
> > >> > > wrote:
> > >> > > >>
> > >> > > >>  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:
> > >> > > >>>>
> > >> > > >>>> <!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>
> > >> > > >>>>
> > >> > > >>>> -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
> > >> > > >>>>> <head>
> > >> > > >>>>> 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 <
> > >> > agrieve@chromium.org
> > >> > > >
> > >> > > >>>>> 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 <
> > >> > > >>>>>> leolib2004@gmail.com>
> > >> > > >>>>>> 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:
> > >> > > >>>>>>>
> > >> > > >>>>>>> <body onload="onLoad()">
> > >> > > >>>>>>>           <div id="mainDiv">
> > >> > > >>>>>>>               <div id="deviceready" class="blink">
> > >> > > >>>>>>>                   <p class="event listening">Connecting to
> > >> > > Device</p>
> > >> > > >>>>>>>                   <p class="event received">Device is
> > >> Ready</p>
> > >> > > >>>>>>>               </div>
> > >> > > >>>>>>>
> > >> > > >>>>>>> ....
> > >> > > >>>>>>> </body>
> > >> > > >>>>>>>
> > >> > > >>>>>>> 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.
> > >> > > >>>>>>>
> > >> > > >>>>>>>
> > >> > > >>>>>>>
> > >> > > >>>>>
> > >> > > >
> > >> > >
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > Carlos Santana
> > >> > <cs...@gmail.com>
> > >> >
> > >>
> > >>
> > >>
> > >> --
> > >> Leonardo.
> > >>
> > >
> > >
> >
> >
> > --
> > Leonardo.
> >
>
>
>
> --
> Carlos Santana
> <cs...@gmail.com>
>

Re: OnDeviceReady with unstable behaviour

Posted by Carlos Santana <cs...@gmail.com>.
stupid mailing list doesn't allow images, Feeling ->"punch me in the face
now"

here is an image:

http://bit.ly/1m1CLOT




On Thu, Aug 14, 2014 at 7:09 PM, Leonardo Martínez <le...@gmail.com>
wrote:

> I can't find the more dropdown and I can't see the image either...
>
>
> On Thu, Aug 14, 2014 at 4:03 PM, Jesse <pu...@gmail.com> wrote:
>
> > 'More' dropdown -> attach files
> >
> > [image: Inline image 1]
> >
> > @purplecabbage
> > risingj.com
> >
> >
> > On Thu, Aug 14, 2014 at 3:55 PM, Leonardo Martínez <leolib2004@gmail.com
> >
> > wrote:
> >
> >> Thanks guys.  How do I add a cordova project into the issue? I signed up
> >> but I don't see how to add that...
> >>
> >>
> >> On Thu, Aug 14, 2014 at 8:09 AM, Carlos Santana <cs...@gmail.com>
> >> wrote:
> >>
> >> > Leonard open a JIRA [1] item, with a simple cordova project to
> recreate
> >> > problem.
> >> >
> >> > Maybe with more details someone can take a look and help.
> >> >
> >> > [1]: https://issues.apache.org/jira/browse/CB
> >> >
> >> >
> >> >
> >> > On Thu, Aug 14, 2014 at 10:09 AM, Andrew Grieve <agrieve@chromium.org
> >
> >> > wrote:
> >> >
> >> > > Hmm, good point. I have no guesses now :(
> >> > >
> >> > >
> >> > > On Wed, Aug 13, 2014 at 10:25 PM, Terence M. Bandoian <
> >> terence@tmbsw.com
> >> > >
> >> > > wrote:
> >> > >
> >> > > > Right. The docs also include the following:
> >> > > >
> >> > > > "The deviceready event behaves somewhat differently from others.
> Any
> >> > > event
> >> > > > handler registered after the deviceready event fires has its
> >> callback
> >> > > > function called immediately."
> >> > > >
> >> > > > -Terence
> >> > > >
> >> > > >
> >> > > >
> >> > > > On 8/13/2014 8:29 PM, Joe Bowser wrote:
> >> > > >
> >> > > >> When subscribing to the events, it should actually run right away
> >> if
> >> > the
> >> > > >> event was already fired. This is definitely a regression in
> >> > cordova.js,
> >> > > or
> >> > > >> a design change I didn't catch. Both are possible.
> >> > > >> On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <
> terence@tmbsw.com>
> >> > > wrote:
> >> > > >>
> >> > > >>  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:
> >> > > >>>>
> >> > > >>>> <!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>
> >> > > >>>>
> >> > > >>>> -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
> >> > > >>>>> <head>
> >> > > >>>>> 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 <
> >> > agrieve@chromium.org
> >> > > >
> >> > > >>>>> 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 <
> >> > > >>>>>> leolib2004@gmail.com>
> >> > > >>>>>> 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:
> >> > > >>>>>>>
> >> > > >>>>>>> <body onload="onLoad()">
> >> > > >>>>>>>           <div id="mainDiv">
> >> > > >>>>>>>               <div id="deviceready" class="blink">
> >> > > >>>>>>>                   <p class="event listening">Connecting to
> >> > > Device</p>
> >> > > >>>>>>>                   <p class="event received">Device is
> >> Ready</p>
> >> > > >>>>>>>               </div>
> >> > > >>>>>>>
> >> > > >>>>>>> ....
> >> > > >>>>>>> </body>
> >> > > >>>>>>>
> >> > > >>>>>>> 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.
> >> > > >>>>>>>
> >> > > >>>>>>>
> >> > > >>>>>>>
> >> > > >>>>>
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > Carlos Santana
> >> > <cs...@gmail.com>
> >> >
> >>
> >>
> >>
> >> --
> >> Leonardo.
> >>
> >
> >
>
>
> --
> Leonardo.
>



-- 
Carlos Santana
<cs...@gmail.com>

Re: OnDeviceReady with unstable behaviour

Posted by Leonardo Martínez <le...@gmail.com>.
I can't find the more dropdown and I can't see the image either...


On Thu, Aug 14, 2014 at 4:03 PM, Jesse <pu...@gmail.com> wrote:

> 'More' dropdown -> attach files
>
> [image: Inline image 1]
>
> @purplecabbage
> risingj.com
>
>
> On Thu, Aug 14, 2014 at 3:55 PM, Leonardo Martínez <le...@gmail.com>
> wrote:
>
>> Thanks guys.  How do I add a cordova project into the issue? I signed up
>> but I don't see how to add that...
>>
>>
>> On Thu, Aug 14, 2014 at 8:09 AM, Carlos Santana <cs...@gmail.com>
>> wrote:
>>
>> > Leonard open a JIRA [1] item, with a simple cordova project to recreate
>> > problem.
>> >
>> > Maybe with more details someone can take a look and help.
>> >
>> > [1]: https://issues.apache.org/jira/browse/CB
>> >
>> >
>> >
>> > On Thu, Aug 14, 2014 at 10:09 AM, Andrew Grieve <ag...@chromium.org>
>> > wrote:
>> >
>> > > Hmm, good point. I have no guesses now :(
>> > >
>> > >
>> > > On Wed, Aug 13, 2014 at 10:25 PM, Terence M. Bandoian <
>> terence@tmbsw.com
>> > >
>> > > wrote:
>> > >
>> > > > Right. The docs also include the following:
>> > > >
>> > > > "The deviceready event behaves somewhat differently from others. Any
>> > > event
>> > > > handler registered after the deviceready event fires has its
>> callback
>> > > > function called immediately."
>> > > >
>> > > > -Terence
>> > > >
>> > > >
>> > > >
>> > > > On 8/13/2014 8:29 PM, Joe Bowser wrote:
>> > > >
>> > > >> When subscribing to the events, it should actually run right away
>> if
>> > the
>> > > >> event was already fired. This is definitely a regression in
>> > cordova.js,
>> > > or
>> > > >> a design change I didn't catch. Both are possible.
>> > > >> On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <te...@tmbsw.com>
>> > > wrote:
>> > > >>
>> > > >>  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:
>> > > >>>>
>> > > >>>> <!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>
>> > > >>>>
>> > > >>>> -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
>> > > >>>>> <head>
>> > > >>>>> 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 <
>> > agrieve@chromium.org
>> > > >
>> > > >>>>> 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 <
>> > > >>>>>> leolib2004@gmail.com>
>> > > >>>>>> 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:
>> > > >>>>>>>
>> > > >>>>>>> <body onload="onLoad()">
>> > > >>>>>>>           <div id="mainDiv">
>> > > >>>>>>>               <div id="deviceready" class="blink">
>> > > >>>>>>>                   <p class="event listening">Connecting to
>> > > Device</p>
>> > > >>>>>>>                   <p class="event received">Device is
>> Ready</p>
>> > > >>>>>>>               </div>
>> > > >>>>>>>
>> > > >>>>>>> ....
>> > > >>>>>>> </body>
>> > > >>>>>>>
>> > > >>>>>>> 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.
>> > > >>>>>>>
>> > > >>>>>>>
>> > > >>>>>>>
>> > > >>>>>
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> > Carlos Santana
>> > <cs...@gmail.com>
>> >
>>
>>
>>
>> --
>> Leonardo.
>>
>
>


-- 
Leonardo.

Re: OnDeviceReady with unstable behaviour

Posted by Jesse <pu...@gmail.com>.
'More' dropdown -> attach files

[image: Inline image 1]

@purplecabbage
risingj.com


On Thu, Aug 14, 2014 at 3:55 PM, Leonardo Martínez <le...@gmail.com>
wrote:

> Thanks guys.  How do I add a cordova project into the issue? I signed up
> but I don't see how to add that...
>
>
> On Thu, Aug 14, 2014 at 8:09 AM, Carlos Santana <cs...@gmail.com>
> wrote:
>
> > Leonard open a JIRA [1] item, with a simple cordova project to recreate
> > problem.
> >
> > Maybe with more details someone can take a look and help.
> >
> > [1]: https://issues.apache.org/jira/browse/CB
> >
> >
> >
> > On Thu, Aug 14, 2014 at 10:09 AM, Andrew Grieve <ag...@chromium.org>
> > wrote:
> >
> > > Hmm, good point. I have no guesses now :(
> > >
> > >
> > > On Wed, Aug 13, 2014 at 10:25 PM, Terence M. Bandoian <
> terence@tmbsw.com
> > >
> > > wrote:
> > >
> > > > Right. The docs also include the following:
> > > >
> > > > "The deviceready event behaves somewhat differently from others. Any
> > > event
> > > > handler registered after the deviceready event fires has its callback
> > > > function called immediately."
> > > >
> > > > -Terence
> > > >
> > > >
> > > >
> > > > On 8/13/2014 8:29 PM, Joe Bowser wrote:
> > > >
> > > >> When subscribing to the events, it should actually run right away if
> > the
> > > >> event was already fired. This is definitely a regression in
> > cordova.js,
> > > or
> > > >> a design change I didn't catch. Both are possible.
> > > >> On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <te...@tmbsw.com>
> > > wrote:
> > > >>
> > > >>  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:
> > > >>>>
> > > >>>> <!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>
> > > >>>>
> > > >>>> -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
> > > >>>>> <head>
> > > >>>>> 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 <
> > agrieve@chromium.org
> > > >
> > > >>>>> 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 <
> > > >>>>>> leolib2004@gmail.com>
> > > >>>>>> 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:
> > > >>>>>>>
> > > >>>>>>> <body onload="onLoad()">
> > > >>>>>>>           <div id="mainDiv">
> > > >>>>>>>               <div id="deviceready" class="blink">
> > > >>>>>>>                   <p class="event listening">Connecting to
> > > Device</p>
> > > >>>>>>>                   <p class="event received">Device is Ready</p>
> > > >>>>>>>               </div>
> > > >>>>>>>
> > > >>>>>>> ....
> > > >>>>>>> </body>
> > > >>>>>>>
> > > >>>>>>> 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.
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>
> > > >
> > >
> >
> >
> >
> > --
> > Carlos Santana
> > <cs...@gmail.com>
> >
>
>
>
> --
> Leonardo.
>

Re: OnDeviceReady with unstable behaviour

Posted by Leonardo Martínez <le...@gmail.com>.
Thanks guys.  How do I add a cordova project into the issue? I signed up
but I don't see how to add that...


On Thu, Aug 14, 2014 at 8:09 AM, Carlos Santana <cs...@gmail.com>
wrote:

> Leonard open a JIRA [1] item, with a simple cordova project to recreate
> problem.
>
> Maybe with more details someone can take a look and help.
>
> [1]: https://issues.apache.org/jira/browse/CB
>
>
>
> On Thu, Aug 14, 2014 at 10:09 AM, Andrew Grieve <ag...@chromium.org>
> wrote:
>
> > Hmm, good point. I have no guesses now :(
> >
> >
> > On Wed, Aug 13, 2014 at 10:25 PM, Terence M. Bandoian <terence@tmbsw.com
> >
> > wrote:
> >
> > > Right. The docs also include the following:
> > >
> > > "The deviceready event behaves somewhat differently from others. Any
> > event
> > > handler registered after the deviceready event fires has its callback
> > > function called immediately."
> > >
> > > -Terence
> > >
> > >
> > >
> > > On 8/13/2014 8:29 PM, Joe Bowser wrote:
> > >
> > >> When subscribing to the events, it should actually run right away if
> the
> > >> event was already fired. This is definitely a regression in
> cordova.js,
> > or
> > >> a design change I didn't catch. Both are possible.
> > >> On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <te...@tmbsw.com>
> > wrote:
> > >>
> > >>  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:
> > >>>>
> > >>>> <!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>
> > >>>>
> > >>>> -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
> > >>>>> <head>
> > >>>>> 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 <
> agrieve@chromium.org
> > >
> > >>>>> 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 <
> > >>>>>> leolib2004@gmail.com>
> > >>>>>> 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:
> > >>>>>>>
> > >>>>>>> <body onload="onLoad()">
> > >>>>>>>           <div id="mainDiv">
> > >>>>>>>               <div id="deviceready" class="blink">
> > >>>>>>>                   <p class="event listening">Connecting to
> > Device</p>
> > >>>>>>>                   <p class="event received">Device is Ready</p>
> > >>>>>>>               </div>
> > >>>>>>>
> > >>>>>>> ....
> > >>>>>>> </body>
> > >>>>>>>
> > >>>>>>> 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.
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>
> > >
> >
>
>
>
> --
> Carlos Santana
> <cs...@gmail.com>
>



-- 
Leonardo.

Re: OnDeviceReady with unstable behaviour

Posted by Carlos Santana <cs...@gmail.com>.
Leonard open a JIRA [1] item, with a simple cordova project to recreate
problem.

Maybe with more details someone can take a look and help.

[1]: https://issues.apache.org/jira/browse/CB



On Thu, Aug 14, 2014 at 10:09 AM, Andrew Grieve <ag...@chromium.org>
wrote:

> Hmm, good point. I have no guesses now :(
>
>
> On Wed, Aug 13, 2014 at 10:25 PM, Terence M. Bandoian <te...@tmbsw.com>
> wrote:
>
> > Right. The docs also include the following:
> >
> > "The deviceready event behaves somewhat differently from others. Any
> event
> > handler registered after the deviceready event fires has its callback
> > function called immediately."
> >
> > -Terence
> >
> >
> >
> > On 8/13/2014 8:29 PM, Joe Bowser wrote:
> >
> >> When subscribing to the events, it should actually run right away if the
> >> event was already fired. This is definitely a regression in cordova.js,
> or
> >> a design change I didn't catch. Both are possible.
> >> On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <te...@tmbsw.com>
> wrote:
> >>
> >>  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:
> >>>>
> >>>> <!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>
> >>>>
> >>>> -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
> >>>>> <head>
> >>>>> 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 <agrieve@chromium.org
> >
> >>>>> 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 <
> >>>>>> leolib2004@gmail.com>
> >>>>>> 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:
> >>>>>>>
> >>>>>>> <body onload="onLoad()">
> >>>>>>>           <div id="mainDiv">
> >>>>>>>               <div id="deviceready" class="blink">
> >>>>>>>                   <p class="event listening">Connecting to
> Device</p>
> >>>>>>>                   <p class="event received">Device is Ready</p>
> >>>>>>>               </div>
> >>>>>>>
> >>>>>>> ....
> >>>>>>> </body>
> >>>>>>>
> >>>>>>> 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.
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>
> >
>



-- 
Carlos Santana
<cs...@gmail.com>

Re: OnDeviceReady with unstable behaviour

Posted by Andrew Grieve <ag...@chromium.org>.
Hmm, good point. I have no guesses now :(


On Wed, Aug 13, 2014 at 10:25 PM, Terence M. Bandoian <te...@tmbsw.com>
wrote:

> Right. The docs also include the following:
>
> "The deviceready event behaves somewhat differently from others. Any event
> handler registered after the deviceready event fires has its callback
> function called immediately."
>
> -Terence
>
>
>
> On 8/13/2014 8:29 PM, Joe Bowser wrote:
>
>> When subscribing to the events, it should actually run right away if the
>> event was already fired. This is definitely a regression in cordova.js, or
>> a design change I didn't catch. Both are possible.
>> On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <te...@tmbsw.com> wrote:
>>
>>  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:
>>>>
>>>> <!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>
>>>>
>>>> -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
>>>>> <head>
>>>>> 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 <ag...@chromium.org>
>>>>> 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 <
>>>>>> leolib2004@gmail.com>
>>>>>> 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:
>>>>>>>
>>>>>>> <body onload="onLoad()">
>>>>>>>           <div id="mainDiv">
>>>>>>>               <div id="deviceready" class="blink">
>>>>>>>                   <p class="event listening">Connecting to Device</p>
>>>>>>>                   <p class="event received">Device is Ready</p>
>>>>>>>               </div>
>>>>>>>
>>>>>>> ....
>>>>>>> </body>
>>>>>>>
>>>>>>> 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.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>

Re: OnDeviceReady with unstable behaviour

Posted by "Terence M. Bandoian" <te...@tmbsw.com>.
Right. The docs also include the following:

"The deviceready event behaves somewhat differently from others. Any 
event handler registered after the deviceready event fires has its 
callback function called immediately."

-Terence


On 8/13/2014 8:29 PM, Joe Bowser wrote:
> When subscribing to the events, it should actually run right away if the
> event was already fired. This is definitely a regression in cordova.js, or
> a design change I didn't catch. Both are possible.
> On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <te...@tmbsw.com> wrote:
>
>> 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:
>>>
>>> <!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>
>>>
>>> -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 <head>
>>>> 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 <ag...@chromium.org>
>>>> 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 <
>>>>> leolib2004@gmail.com>
>>>>> 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:
>>>>>>
>>>>>> <body onload="onLoad()">
>>>>>>           <div id="mainDiv">
>>>>>>               <div id="deviceready" class="blink">
>>>>>>                   <p class="event listening">Connecting to Device</p>
>>>>>>                   <p class="event received">Device is Ready</p>
>>>>>>               </div>
>>>>>>
>>>>>> ....
>>>>>> </body>
>>>>>>
>>>>>> 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.
>>>>>>
>>>>>>
>>>>


Re: OnDeviceReady with unstable behaviour

Posted by Joe Bowser <bo...@gmail.com>.
When subscribing to the events, it should actually run right away if the
event was already fired. This is definitely a regression in cordova.js, or
a design change I didn't catch. Both are possible.
On Aug 13, 2014 5:59 PM, "Terence M. Bandoian" <te...@tmbsw.com> wrote:

> 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:
>>
>> <!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>
>>
>> -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 <head>
>>> 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 <ag...@chromium.org>
>>> 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 <
>>>> leolib2004@gmail.com>
>>>> 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:
>>>>>
>>>>> <body onload="onLoad()">
>>>>>          <div id="mainDiv">
>>>>>              <div id="deviceready" class="blink">
>>>>>                  <p class="event listening">Connecting to Device</p>
>>>>>                  <p class="event received">Device is Ready</p>
>>>>>              </div>
>>>>>
>>>>> ....
>>>>> </body>
>>>>>
>>>>> 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.
>>>>>
>>>>>
>>>
>>>
>>
>

Re: OnDeviceReady with unstable behaviour

Posted by "Terence M. Bandoian" <te...@tmbsw.com>.
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:
>
> <!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>
>
> -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 <head>
>> 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 <ag...@chromium.org> 
>> 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 
>>> <le...@gmail.com>
>>> 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:
>>>>
>>>> <body onload="onLoad()">
>>>>          <div id="mainDiv">
>>>>              <div id="deviceready" class="blink">
>>>>                  <p class="event listening">Connecting to Device</p>
>>>>                  <p class="event received">Device is Ready</p>
>>>>              </div>
>>>>
>>>> ....
>>>> </body>
>>>>
>>>> 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.
>>>>
>>
>>
>


Re: OnDeviceReady with unstable behaviour

Posted by "Terence M. Bandoian" <te...@tmbsw.com>.
 From the phonegap 3.5.0 docs:

<!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>

-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 <head>
> 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 <ag...@chromium.org> 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 <le...@gmail.com>
>> 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:
>>>
>>> <body onload="onLoad()">
>>>          <div id="mainDiv">
>>>              <div id="deviceready" class="blink">
>>>                  <p class="event listening">Connecting to Device</p>
>>>                  <p class="event received">Device is Ready</p>
>>>              </div>
>>>
>>> ....
>>> </body>
>>>
>>> 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.
>>>
>
>


Re: OnDeviceReady with unstable behaviour

Posted by Carlos Santana <cs...@gmail.com>.
Like Andrew mentioned too late to add the listener.

Where are you putting your cordova.js? If you are loading it from <head>
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 <ag...@chromium.org> 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 <le...@gmail.com>
> 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:
> >
> > <body onload="onLoad()">
> >         <div id="mainDiv">
> >             <div id="deviceready" class="blink">
> >                 <p class="event listening">Connecting to Device</p>
> >                 <p class="event received">Device is Ready</p>
> >             </div>
> >
> > ....
> > </body>
> >
> > 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.
> >
>



-- 
Carlos Santana
<cs...@gmail.com>

Re: OnDeviceReady with unstable behaviour

Posted by Andrew Grieve <ag...@chromium.org>.
My guess: Don't wait until onload to register your deviceready listener.


On Wed, Aug 13, 2014 at 1:43 PM, Leonardo Martínez <le...@gmail.com>
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:
>
> <body onload="onLoad()">
>         <div id="mainDiv">
>             <div id="deviceready" class="blink">
>                 <p class="event listening">Connecting to Device</p>
>                 <p class="event received">Device is Ready</p>
>             </div>
>
> ....
> </body>
>
> 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.
>