platform/packages/poll/example/main.dart
Tobe O aa092a4111 Add 'packages/poll/' from commit '14637ac137e083a90e1db397f0a90561888c3bde'
git-subtree-dir: packages/poll
git-subtree-mainline: a5f5661650
git-subtree-split: 14637ac137
2020-02-15 18:29:16 -05:00

21 lines
504 B
Dart

import 'package:angel_client/io.dart';
import 'package:angel_poll/angel_poll.dart';
main() {
var app = new Rest('http://localhost:3000');
var todos = new ServiceList(
new PollingService(
// Typically, you'll pass a REST-based service instance here.
app.service('api/todos'),
// `index` called every 5 seconds
const Duration(seconds: 5),
),
);
todos.onChange.listen((_) {
// Something happened here.
// Maybe an item was created, modified, etc.
});
}