mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-09 20:15:07 +00:00
(MatchMediaService) Added a debounce so that the layout changes can work a lot more stable on media changes
This commit is contained in:
parent
08e2d5f331
commit
f7f3a60ff5
|
@ -1,6 +1,7 @@
|
|||
import { MediaChange, ObservableMedia } from '@angular/flex-layout';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -38,7 +39,11 @@ export class FuseMatchMediaService
|
|||
*/
|
||||
private _init(): void
|
||||
{
|
||||
this._observableMedia
|
||||
this._observableMedia.asObservable()
|
||||
.pipe(
|
||||
debounceTime(500),
|
||||
distinctUntilChanged()
|
||||
)
|
||||
.subscribe((change: MediaChange) => {
|
||||
if ( this.activeMediaQuery !== change.mqAlias )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user