W Dart dlaczego kod poniżej (o MutationObserver) nie działa?
Zmodyfikowałem jeden przykład polimeru Dart, aby przetestować MutationObserver. To nie działa! Jakieś sugestie?
To jest kod HTML:
<body>
<ul>
<template id="tmpl" repeat>
<li>{{}}</li>
</template>
</ul>
</body>
To jest kod Dart:
MutationObserver observer = new MutationObserver(_onMutation);
observer.observe(query('#tmpl'), childList: true, subtree: true);
List timestamps = toObservable([]);
query('#tmpl').model = timestamps;
new Timer.periodic(const Duration(seconds: 1), (_) {
timestamps.add(new DateTime.now());
});
_onMutation(List<MutationRecord> mutations, MutationObserver observer) {
print('hello test MutationObserver'); **//there is not any print!!!!!!!!!!!**
}
Masz pojęcie, dlaczego to nie zadziała?
[Uwaga: wyświetlanie strony jest w porządku, problem dotyczy tylko serwera MutationObserver]
Dzięki!