2017-12-21 19:24:49 +00:00
|
|
|
import 'package:angel_client/io.dart';
|
|
|
|
import 'package:angel_poll/angel_poll.dart';
|
|
|
|
|
2021-06-20 12:37:20 +00:00
|
|
|
void main() {
|
|
|
|
var app = Rest('http://localhost:3000');
|
2017-12-21 19:24:49 +00:00
|
|
|
|
2021-06-20 12:37:20 +00:00
|
|
|
var todos = ServiceList(
|
|
|
|
PollingService(
|
2017-12-21 19:24:49 +00:00
|
|
|
// 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.
|
|
|
|
});
|
|
|
|
}
|