DomService class

Utility class to synchronize DOM operations across components, e.g. to check changes in the layout after a UI update or application event.

Constructors

DomService(NgZone _ngZone, Window _window)
Creates an instance that automatically runs outside of ngZone, and uses the browser-supplied (Window) for animation frames and resizing checks.

Properties

hashCode int
The hash code for this object.
no setterinherited
hasPendingUpdate bool
Whether there is any pending update.
no setter
isDomMutatedPredicate IsDomMutatedPredicate?
Optional callback to check if DOM has been mutated by angular in a zone turn.
getter/setter pair
isReadingDom bool
Indicates to users that we are currently processing items in the read queue.
no setter
isStable bool
Whether the view can be considered as stable.
no setter
isWritingDom bool
Indicates to users that we are currently processing items in the write queue.
no setter
nextFrame Future<num>?
A future that completes with an animation frame.
no setter
onIdle Stream<Null>?
A stream that fires when the browser seems to be idle.
no setter
onLayoutChanged Stream<DomService>?
A stream that fires when a component should do a layout check.
no setter
onQueuesProcessed Stream<DomService>?
A stream that fires when the queues have been processed and are now empty.
no setter
resetIsDomMutated Function?
Optional callback to reset dom mutation state for predicate.
getter/setter pair
rootZone Zone
no getter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state DomServiceState
Returns the current state of the service.
no setter

Methods

addLayoutObserver(void domReadCallback()) StreamSubscription<DomService>
Adds a new callback to the layout observer heartbeat.
describeStability() String
init() → void
Initializes the DomService to send window events, in order to coordinate layout checks across apps on the same page.
leap({num? highResTimer, dynamic steps = 1}) → void
Advances the animation frame future, without waiting for the window's callback. If there were already an animation frame scheduled, it will cancel it.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onRead() Future<void>
A future-based API version of scheduleRead.
onWrite() Future<void>
A future-based API version of scheduleWrite.
requestLayoutFrame() → void
scheduleRead(DomReadWriteFn fn) Disposable
Schedules a coordinated DOM read. If already isReadingDom, fn is executed synchronously.
scheduleWrite(DomReadWriteFn fn) Disposable
Schedules a coordinated DOM write. If already isWritingDom, fn is executed synchronously.
toString() String
A string representation of this object.
inherited
trackLayoutChange<T>(T fn(), void callback(T), {int framesToStabilize = 1, bool runInAngularZone = false}) StreamSubscription<DomService>
Tracks a layout change defined by fn, and calls the callback function with the last stable value.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

maintainZoneOnCallbacks bool
Whether to execute functions scheduled within Zone.current.
getter/setter pair