[Qt-qml] Sleeping in javascript

Alex alexlordax+qt at gmail.com
Thu Sep 30 20:39:02 CEST 2010


Thanks for the suggestion, Mat.  I created a javascript component that
sequences an arbitrary set of animations.  In some cases, I need to
wait until an animation completes and then pause for some time before
executing the next one.  I was hoping that there would be a clean
imperative way of doing that.

I considered using the Timer approach, but in the end it made more
sense to use PauseAnimation and just treat it as the next animation to
be run immediately after the previous one and then wait for its
completion.

Cheers,
Alex

On Mon, Sep 27, 2010 at 3:28 PM, Mateu Batle
<mateu.batle at collabora.co.uk> wrote:
>  Hi Alex,
>
> one way could be to create a dynamic QML Timer object and customize it
>
> http://doc.qt.nokia.com/4.7-snapshot/qml-timer.html
>
> But maybe there is another solution depending on the specific usage,
> what do you need the timeout for ?
>
> cheers
>  Mat
>
>
> On 09/27/2010 02:59 PM, Alex wrote:
>> Hi,
>>
>> I know javascript doesn't have a sleep() per se, but I've tried using
>> the setTimeout() function, which I thought was standard, like so:
>>
>>         setTimeout("console.log(\"foo\")", 1000)
>>
>> This is the result:
>>
>>         ReferenceError: Can't find variable: setTimeout
>>
>> What is the recommended way to pause/sleep within a javascript block?
>>
>> Thanks,
>> Alex
>> _______________________________________________
>> Qt-qml mailing list
>> Qt-qml at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-qml
>
>
> --
> Mateu Batle
> Software Engineer
> Collabora Ltd.
>
>




More information about the Qt-qml mailing list