angular-cn/public/docs/_examples/lifecycle-hooks/dart/lib/logger_service.dart

20 lines
290 B
Dart

import 'dart:async';
import 'package:angular2/core.dart';
@Injectable()
class LoggerService {
List<String> logs = [];
log(String msg, [bool noTick = false]) {
if (!noTick) {
tick();
}
logs.add(msg);
}
clear() => logs.clear();
tick() => new Future(() {});
}