44 lines
941 B
JavaScript
44 lines
941 B
JavaScript
import ngModule from '../module';
|
|
|
|
/**
|
|
* The main application class.
|
|
*
|
|
* @property {String} name The application name.
|
|
* @property {Snackbar} snackbar The main object to show messages.
|
|
*/
|
|
export default class App {
|
|
constructor() {
|
|
this.loaderStatus = 0;
|
|
this.loading = false;
|
|
}
|
|
|
|
showMessage(message) {
|
|
if (this.snackbar)
|
|
this.snackbar.show({message: message});
|
|
}
|
|
|
|
showSuccess(message) {
|
|
if (this.snackbar)
|
|
this.snackbar.showSuccess({message: message});
|
|
}
|
|
|
|
showError(message) {
|
|
if (this.snackbar)
|
|
this.snackbar.showError({message: message});
|
|
}
|
|
|
|
pushLoader() {
|
|
this.loaderStatus++;
|
|
if (this.loaderStatus === 1)
|
|
this.loading = true;
|
|
}
|
|
|
|
popLoader() {
|
|
this.loaderStatus--;
|
|
if (this.loaderStatus === 0)
|
|
this.loading = false;
|
|
}
|
|
}
|
|
|
|
ngModule.service('vnApp', App);
|