init method
void
init()
Initializes the DomService to send window events, in order to coordinate layout checks across apps on the same page.
Implementation
void init() {
if (_crossAppInitialized) return;
_crossAppInitialized = true;
_ngZone.runOutsideAngular(() {
_ngZone.onEventDone.listen((_) {
if (isDomMutatedPredicate == null || isDomMutatedPredicate!()) {
// Sending an event to DomService in other apps on the same page.
_inDispatchTurnDoneEvent = true;
_window.dispatchEvent(Event(_TURN_DONE_EVENT_TYPE));
_inDispatchTurnDoneEvent = false;
// If dom has been mutated by angular, mark [_writeQueueChangedLayout]
// to true. So that [_scheduleOnLayoutChanged] will be called normally
// when there is a request to change layout.
if (isDomMutatedPredicate != null && isDomMutatedPredicate!()) {
_writeQueueChangedLayout = true;
}
if (resetIsDomMutated != null) {
resetIsDomMutated!();
}
}
});
});
}