Timer.hx 905 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package eval.luv;
  2. /**
  3. Timers.
  4. @see https://aantron.github.io/luv/luv/Luv/Timer
  5. **/
  6. @:using(eval.luv.Handle)
  7. @:coreType abstract Timer to Handle {
  8. /** The timer repeat interval. */
  9. public var repeat(get,set):Int;
  10. function get_repeat():Int;
  11. function set_repeat(v:Int):Int;
  12. /** Evaluates to the time until the timer expires, or zero if it has already expired. */
  13. public var dueIn(get,never):Int;
  14. function get_dueIn():Int;
  15. /**
  16. Allocate and initialize an idle handle.
  17. The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
  18. **/
  19. static public function init(loop:Loop):Result<Timer>;
  20. /**
  21. Starts a timer.
  22. **/
  23. public function start(callback:()->Void, timeoutMs:Int, ?repeatMs:Int):Result<Result.NoData>;
  24. /**
  25. Stops a timer.
  26. **/
  27. public function stop():Result<Result.NoData>;
  28. /**
  29. Restarts a timer.
  30. **/
  31. public function again():Result<Result.NoData>;
  32. }