onIdle property

Stream<Null>? get onIdle

A stream that fires when the browser seems to be idle.

NOTE:

  • This is an EXPERIMENTAL feature, and should be used with extreme care.
  • Subscriptions to the stream should be cancelled as soon as possible.

Implementation

Stream<Null>? get onIdle {
  if (_onIdleStream == null) {
    _onIdleController = StreamController.broadcast(
        sync: true, onListen: _resetIdleTimer, onCancel: _resetIdleTimer);
    // TODO(google): consider scoping it to be inside the managed zone:
    _onIdleStream =
        ZonedStream(_onIdleController!.stream, _ngZone.runOutsideAngular);
    // TODO(google): integrate with Chrome's new idle detection API
  }
  return _onIdleStream;
}