leaf-framework
Version:
Light Everis Angular Frontend Framework
50 lines • 2.01 kB
JavaScript
import { Component, Inject } from '@angular/core';
import { LoggerService } from '../services/logger.service';
import { SpinnerService } from './spinner.service';
import { fadeInAnimation } from '../animations/fade-in.animation';
var SpinnerComponent = /** @class */ (function () {
function SpinnerComponent(loggerService, spinnerService) {
this.loggerService = loggerService;
this.spinnerService = spinnerService;
this.visible = false;
this.count = 0;
}
SpinnerComponent.prototype.ngOnInit = function () {
var _this = this;
this.loggerService.log('... initializing spinner component from core module.');
this.spinnerStateChanged = this.spinnerService.spinnerState
.subscribe(function (state) {
if (state.show) {
_this.count++;
}
else {
_this.count--;
}
if (_this.count > 0) {
_this.visible = true;
}
else {
_this.visible = false;
}
// this.visible = state.show;
});
};
SpinnerComponent.prototype.ngOnDestroy = function () {
this.spinnerStateChanged.unsubscribe();
};
SpinnerComponent.decorators = [
{ type: Component, args: [{
selector: '[leaf-spinner]',
template: "\n <a class=\"btn btn-primary minimalize-styl-item\" *ngIf=\"visible\" [@fadeInAnimation]><i class=\"fa fa-circle-o-notch fa-spin\"></i></a>\n ",
animations: [fadeInAnimation]
},] },
];
/** @nocollapse */
SpinnerComponent.ctorParameters = function () { return [
{ type: LoggerService, decorators: [{ type: Inject, args: ['LoggerService',] },] },
{ type: SpinnerService, },
]; };
return SpinnerComponent;
}());
export { SpinnerComponent };
//# sourceMappingURL=spinner.component.js.map