import { Injectable } from '@angular/core' ; import { select , Store } from '@ngrx/store' ; import { ResponsiveService } from '../interfaces/responsive-service.interface' ; import { ResponsiveProperties } from '../interfaces/responsive.interface' ; import { fromResponsiveActions } from './responsive.actions' ; import { ResponsivePartialState } from './responsive.reducer' ; import { responsiveQuery } from './responsive.selectors' ; @ Injectable ( ) export class ResponsiveFacade { /**
     * Observed height
     */ height$ = this . store . pipe ( select ( responsiveQuery . getHeight ) ) ; /**
     * Observed initialized
     */ initialized$ = this . store . pipe ( select ( responsiveQuery . getInitialized ) ) ; /**
     * Observed has mobile
     */ mobile$ = this . store . pipe ( select ( responsiveQuery . getMobile ) ) ; /**
     * Observed properties
     */ props$ = this . store . pipe ( select ( responsiveQuery . getProperties ) ) ; /**
     * Observed responsive type
     */ responsiveType$ = this . store . pipe ( select ( responsiveQuery . getResponsiveType ) ) ; /**
     * Observed width
     */ width$ = this . store . pipe ( select ( responsiveQuery . getWidth ) ) ; constructor ( private store , private responsiveService ) { } param payload init ( payload ? ) { this . store . dispatch ( new fromResponsiveActions . InitWindowProps ( payload ) ) ; } param props setProps ( props ) { const payload = this . responsiveService . getChangesByProperties ( props ) ; this . store . dispatch ( new fromResponsiveActions . SetWindowProps ( payload ) ) ; } }