2018-02-10 15:18:01 +00:00
|
|
|
import ngModule from '../module';
|
2017-06-05 07:01:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The main application class.
|
|
|
|
*
|
|
|
|
* @property {String} name The application name.
|
|
|
|
* @property {Snackbar} snackbar The main object to show messages.
|
|
|
|
*/
|
|
|
|
export default class App {
|
2018-05-25 15:25:35 +00:00
|
|
|
constructor() {
|
2017-11-16 12:47:18 +00:00
|
|
|
this.loaderStatus = 0;
|
2018-05-25 15:25:35 +00:00
|
|
|
this.loading = false;
|
2017-11-16 12:47:18 +00:00
|
|
|
}
|
2018-06-19 06:12:36 +00:00
|
|
|
|
2017-06-05 07:01:21 +00:00
|
|
|
showMessage(message) {
|
2018-02-20 09:00:19 +00:00
|
|
|
if (this.snackbar)
|
|
|
|
this.snackbar.show({message: message});
|
2017-06-05 07:01:21 +00:00
|
|
|
}
|
2018-06-19 06:12:36 +00:00
|
|
|
|
|
|
|
showSuccess(message) {
|
|
|
|
if (this.snackbar)
|
|
|
|
this.snackbar.showSuccess({message: message});
|
|
|
|
}
|
|
|
|
|
2017-06-05 07:01:21 +00:00
|
|
|
showError(message) {
|
2018-02-20 09:00:19 +00:00
|
|
|
if (this.snackbar)
|
2018-05-31 14:27:06 +00:00
|
|
|
this.snackbar.showError({message: message});
|
2017-06-05 07:01:21 +00:00
|
|
|
}
|
2018-06-19 06:12:36 +00:00
|
|
|
|
2017-11-16 12:47:18 +00:00
|
|
|
pushLoader() {
|
|
|
|
this.loaderStatus++;
|
|
|
|
if (this.loaderStatus === 1)
|
2018-05-25 15:25:35 +00:00
|
|
|
this.loading = true;
|
2017-11-16 12:47:18 +00:00
|
|
|
}
|
2018-06-19 06:12:36 +00:00
|
|
|
|
2017-11-16 12:47:18 +00:00
|
|
|
popLoader() {
|
|
|
|
this.loaderStatus--;
|
|
|
|
if (this.loaderStatus === 0)
|
2018-05-25 15:25:35 +00:00
|
|
|
this.loading = false;
|
2017-11-16 12:47:18 +00:00
|
|
|
}
|
2017-06-05 07:01:21 +00:00
|
|
|
}
|
2017-11-16 12:47:18 +00:00
|
|
|
|
2018-02-10 15:18:01 +00:00
|
|
|
ngModule.service('vnApp', App);
|