return this._platform.isBrowser ? Observable.create(function (observer) {
     if (!_this._globalSubscription) {
         _this._addGlobalListener();
     }
     // In the case of a 0ms delay, use an observable without auditTime
     // since it does add a perceptible delay in processing overhead.
     var /** @type {?} */ subscription = auditTimeInMs > 0 ?
         _this._scrolled.pipe(auditTime(auditTimeInMs)).subscribe(observer) :
         _this._scrolled.subscribe(observer);
     _this._scrolledCount++;
     return function () {
         subscription.unsubscribe();
         _this._scrolledCount--;
         if (!_this._scrolledCount) {
             _this._removeGlobalListener();
         }
     };
 }) : of();
Ejemplo n.º 2
0
 return this._platform.isBrowser ? Observable.create(observer => {
     if (!this._globalSubscription) {
         this._addGlobalListener();
     }
     // In the case of a 0ms delay, use an observable without auditTime
     // since it does add a perceptible delay in processing overhead.
     const /** @type {?} */ subscription = auditTimeInMs > 0 ?
         this._scrolled.pipe(auditTime(auditTimeInMs)).subscribe(observer) :
         this._scrolled.subscribe(observer);
     this._scrolledCount++;
     return () => {
         subscription.unsubscribe();
         this._scrolledCount--;
         if (this._globalSubscription && !this._scrolledCount) {
             this._globalSubscription.unsubscribe();
             this._globalSubscription = null;
         }
     };
 }) : of();
Ejemplo n.º 3
0
 /**
  * Returns a stream that emits whenever the size of the viewport changes.
  * @param {?=} throttleTime
  * @return {?}
  */
 change(throttleTime = DEFAULT_RESIZE_TIME) {
     return throttleTime > 0 ? this._change.pipe(auditTime(throttleTime)) : this._change;
 }
Ejemplo n.º 4
0
 ViewportRuler.prototype.change = /**
  * Returns a stream that emits whenever the size of the viewport changes.
  * @param {?=} throttleTime
  * @return {?}
  */
 function (throttleTime) {
     if (throttleTime === void 0) { throttleTime = DEFAULT_RESIZE_TIME; }
     return throttleTime > 0 ? this._change.pipe(auditTime(throttleTime)) : this._change;
 };
 this._ngZone.runOutsideAngular(() => {
     fromEvent(window, 'resize')
         .pipe(auditTime(16), takeUntil(this._destroyed))
         .subscribe(() => this.resizeToFitContent(true));
 });