Created
October 8, 2020 08:50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Timer { | |
factory Timer(Duration duration, void callback()) { | |
// Create timer with current zone | |
return Zone.current | |
.createTimer(duration, Zone.current.bindCallbackGuarded(callback)); | |
} | |
// ... | |
// Create timer from environment | |
external static Timer _createTimer(Duration duration, void callback()); | |
} | |
class _RootZone implements Zone { | |
// ... | |
Timer createTimer(Duration duration, void f()) { | |
return Timer._createTimer(duration, f); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment