src/app/stores/loader.store.ts
Properties |
|
Methods |
error | ||||||
error(message: string)
|
||||||
Defined in src/app/stores/loader.store.ts:27
|
||||||
Parameters :
Returns :
void
|
hide |
hide()
|
Defined in src/app/stores/loader.store.ts:19
|
Returns :
void
|
show |
show()
|
Defined in src/app/stores/loader.store.ts:15
|
Returns :
void
|
success | ||||||
success(message: string)
|
||||||
Defined in src/app/stores/loader.store.ts:23
|
||||||
Parameters :
Returns :
void
|
Public isError$ |
isError$:
|
Default value : this.isErrorSource.asObservable()
|
Defined in src/app/stores/loader.store.ts:13
|
Private isErrorSource |
isErrorSource:
|
Default value : new BehaviorSubject<string>(null)
|
Defined in src/app/stores/loader.store.ts:9
|
Public isSuccess$ |
isSuccess$:
|
Default value : this.isSuccessSource.asObservable()
|
Defined in src/app/stores/loader.store.ts:12
|
Private isSuccessSource |
isSuccessSource:
|
Default value : new BehaviorSubject<string>(null)
|
Defined in src/app/stores/loader.store.ts:8
|
Public isVisible$ |
isVisible$:
|
Default value : this.isVisibleSource.asObservable()
|
Defined in src/app/stores/loader.store.ts:11
|
Private isVisibleSource |
isVisibleSource:
|
Default value : new BehaviorSubject<boolean>(false)
|
Defined in src/app/stores/loader.store.ts:7
|
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
@Injectable()
export class LoaderStore {
// Observable sources
private isVisibleSource = new BehaviorSubject<boolean>(false);
private isSuccessSource = new BehaviorSubject<string>(null);
private isErrorSource = new BehaviorSubject<string>(null);
// Observable streams
public isVisible$ = this.isVisibleSource.asObservable();
public isSuccess$ = this.isSuccessSource.asObservable();
public isError$ = this.isErrorSource.asObservable();
show() {
this.isVisibleSource.next(true);
}
hide() {
this.isVisibleSource.next(false);
}
success(message: string) {
this.isSuccessSource.next(message);
}
error(message: string) {
this.isErrorSource.next(message);
}
}