CreatePeriodicTimerHandler typedef

Timer CreatePeriodicTimerHandler (
  1. Zone self,
  2. ZoneDelegate parent,
  3. Zone zone,
  4. Duration period,
  5. void f(
    1. Timer timer
    )
)

The type of a custom Zone.createPeriodicTimer implementation function.

Receives the Zone that the handler was registered on as self, a delegate forwarding to the handlers of self's parent zone as parent, and the current zone where the error was uncaught as zone, which will have self as a parent zone.

The callback function f and duration are the ones which were passed to Zone.createPeriodicTimer of zone (possibly through the Timer.periodic constructor).

The custom handler can choose to replace the function f with one that does something before, after or instead of calling f, and then call parent.createTimer(zone, replacement). or it can implement its own timer queue, which typically still depends on parent.createTimer to as a way to get started.

The function should return a Timer object which can be used to inspect and control the scheduled timer callbacks.

Implementation

typedef Timer CreatePeriodicTimerHandler(Zone self, ZoneDelegate parent,
    Zone zone, Duration period, void f(Timer timer));

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-async/CreatePeriodicTimerHandler.html