37 lines
882 B
JavaScript
37 lines
882 B
JavaScript
import {module} 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($rootScope) {
|
|
this.loaderStatus = 0;
|
|
this.$rootScope = $rootScope;
|
|
}
|
|
show(message) {
|
|
if (this.snackbar) this.snackbar.show({message: message});
|
|
}
|
|
showMessage(message) {
|
|
this.show(message);
|
|
}
|
|
showError(message) {
|
|
this.show(`Error: ${message}`);
|
|
}
|
|
pushLoader() {
|
|
this.loaderStatus++;
|
|
if (this.loaderStatus === 1)
|
|
this.$rootScope.loading = true;
|
|
}
|
|
popLoader() {
|
|
this.loaderStatus--;
|
|
if (this.loaderStatus === 0)
|
|
this.$rootScope.loading = false;
|
|
}
|
|
}
|
|
App.$inject = ['$rootScope']
|
|
|
|
module.service('vnApp', App);
|