src/app/models/loader.model.ts
Properties |
Methods |
close |
close()
|
Defined in src/app/models/loader.model.ts:48
|
Returns :
void
|
error | ||||||
error(message: string)
|
||||||
Defined in src/app/models/loader.model.ts:40
|
||||||
Parameters :
Returns :
void
|
setVisibility | ||||||
setVisibility(value: boolean)
|
||||||
Defined in src/app/models/loader.model.ts:24
|
||||||
Parameters :
Returns :
void
|
success | ||||||
success(message: string)
|
||||||
Defined in src/app/models/loader.model.ts:32
|
||||||
Parameters :
Returns :
void
|
closable |
closable:
|
Default value : false
|
Defined in src/app/models/loader.model.ts:13
|
completion |
completion:
|
Type : CompletionState
|
Defined in src/app/models/loader.model.ts:20
|
message |
message:
|
Type : string
|
Default value : 'Loading...'
|
Defined in src/app/models/loader.model.ts:22
|
states |
states:
|
Type : object
|
Default value : {
visibility: VisibilityState,
completion: CompletionState
}
|
Defined in src/app/models/loader.model.ts:14
|
visibility |
visibility:
|
Type : VisibilityState
|
Defined in src/app/models/loader.model.ts:19
|
enum VisibilityState {
VISIBLE,
HIDDEN
}
enum CompletionState {
NONE,
SUCCESS,
ERROR
}
export class LoaderModel {
closable = false;
states = {
visibility: VisibilityState,
completion: CompletionState
};
visibility: VisibilityState;
completion: CompletionState;
message = 'Loading...';
setVisibility(value: boolean) {
this.completion = this.states.completion.NONE;
this.visibility = value
? this.states.visibility.VISIBLE
: this.states.visibility.HIDDEN;
this.closable = !value;
}
success(message: string) {
if (!message || message.length < 1) return;
this.message = message;
this.completion = this.states.completion.SUCCESS;
this.visibility = this.states.visibility.VISIBLE;
this.closable = true;
}
error(message: string) {
if (!message || message.length < 1) return;
this.message = message;
this.completion = this.states.completion.ERROR;
this.visibility = this.states.visibility.VISIBLE;
this.closable = true;
}
close() {
if (this.closable) {
this.message = null;
this.completion = this.states.completion.NONE;
this.visibility = this.states.visibility.HIDDEN;
}
}
}