mirror of
https://github.com/wgh136/pixes.git
synced 2025-09-27 21:07:24 +00:00
21 lines
413 B
Dart
21 lines
413 B
Dart
import 'dart:async';
|
|
|
|
class Loop {
|
|
static final List<void Function()> _callbacks = [];
|
|
|
|
static void start() {
|
|
Timer.periodic(const Duration(milliseconds: 100), (timer) {
|
|
for(var func in _callbacks) {
|
|
func.call();
|
|
}
|
|
});
|
|
}
|
|
|
|
static void register(void Function() func) {
|
|
_callbacks.add(func);
|
|
}
|
|
|
|
static void remove(void Function() func) {
|
|
_callbacks.remove(func);
|
|
}
|
|
} |