Menu

#1 wxTimer

open
nobody
None
5
2007-06-09
2007-06-09
No

I don't see anything in wxJS that can do timers, so I've done a simple conversion of wxTimer.

The constructor can be told of a window to be linked to, and the timer will be destroyed when that window is, to get the effect that C++ destructors normally achieve (because you don't want timers trying to interact with windows that don't exist any more). Or you can not tell it about any window, and it'll just carry on forever (until the JS runtime shuts down and garbage-collects it).

The object is rooted while the timer is running (i.e. between Start and Stop, or Start until a oneShot Notify), so that it continues running while it should.

I haven't tested it much, but it seems to work fine for me - I'm posting it here in case it's useful for anyone else.

Discussion

  • Philip Taylor

    Philip Taylor - 2007-06-09

    timer.cpp

     
  • Philip Taylor

    Philip Taylor - 2007-06-09

    Logged In: YES
    user_id=1108432
    Originator: YES

    File Added: timer.h

     
  • Philip Taylor

    Philip Taylor - 2007-06-09

    timer.h

     

Log in to post a comment.