import { StateOperator } from '@ngxs/store' ; function setLoading < T extends { loading : boolean ; } > ( newValue ) { return ( state ) => { if ( state && state . loading === newValue ) { return state ; } return { ... state , loading : newValue } ; } ; } export function startLoading ( ) { return setLoading ( true ) ; } export function finishedLoading ( ) { return setLoading ( false ) ; } export function setProgress < T extends { progress : number ; } > ( newProgress ) { return ( state ) => { if ( state && state . progress === newProgress ) { return state ; } return { ... state , progress : newProgress } ; } ; }