Skip to content

Latest commit

 

History

History
182 lines (131 loc) · 3.49 KB

Timer.ru.md

File metadata and controls

182 lines (131 loc) · 3.49 KB

Timer

  • класс Timer (php\time\Timer)
  • пакет std
  • исходники php/time/Timer.php

Описание

Class Timer


Статичные Методы

  • Timer ::after() - Run once after the period in format:
  • Timer ::every() - Run every time based on the period as in after() method.
  • Timer ::trigger() - Create trigger timer which once call when trigger callback will return true.
  • Timer ::setTimeout() - Like in JS.
  • Timer ::setInterval() - Like in JS.
  • Timer ::sleep() - Sleep period time.
  • Timer ::cancelAll() - Call all timer tasks which scheduled.
  • Timer ::shutdownAll() - Shutdown all timers and timer system!
  • Timer ::parsePeriod() - Converts a string period to amount of millis.

Методы


Статичные Методы

after()

Timer::after(string $period, callable $callback): Timer

Run once after the period in format: '' - millis 's' - seconds 'm' - minutes 'h' - hours 'd' - days (24 hours)

for example '2h 30m 10s' or '2.5s' or '2000' or '1m 30s'


every()

Timer::every(string $period, callable $callback): Timer

Run every time based on the period as in after() method.


trigger()

Timer::trigger(callable $trigger, callable $callback, int $checkPeriod): Timer

Create trigger timer which once call when trigger callback will return true.


setTimeout()

Timer::setTimeout(callable $taskCallback, int $millis): Timer

Like in JS.


setInterval()

Timer::setInterval(callable $taskCallback, int $millis): Timer

Like in JS.


sleep()

Timer::sleep(string $period): void

Sleep period time.


cancelAll()

Timer::cancelAll(): void

Call all timer tasks which scheduled.


shutdownAll()

Timer::shutdownAll(): void

Shutdown all timers and timer system!


parsePeriod()

Timer::parsePeriod(string $value): int

Converts a string period to amount of millis.

'' - millis 's' - seconds 'm' - minutes 'h' - hours 'd' - days (24 hours)

for example '2h 30m 10s' or '2.5s' or '2000' or '1m 30s'


Методы

__construct()

__construct(): void

Timer constructor.


cancel()

cancel(): void

Cancel timer task.


run()

run(): void

Run timer task.


scheduledTime()

scheduledTime(): void

Returns the scheduled execution time of the most recent actual execution of this task. (If this method is invoked while task execution is in progress, the return value is the scheduled execution time of the ongoing task execution.)