UNPKG

ng2-encrm-components

Version:
55 lines 2.27 kB
"use strict"; var core_1 = require('@angular/core'); // const url = require('file!img!./loading.gif'); var loading_info_state_1 = require('./loading-info-state'); var LoadingInfoComponent = (function () { function LoadingInfoComponent() { this.state = loading_info_state_1.LoadingInfoState.NORMAL; this.loadingInfoState = loading_info_state_1.LoadingInfoState; } LoadingInfoComponent.startLoading = function (id) { setTimeout(function () { var d = LoadingInfoComponent.instances[id]; if (d !== undefined) d.state = loading_info_state_1.LoadingInfoState.LOADING; }); }; LoadingInfoComponent.stopLoading = function (id) { var d = LoadingInfoComponent.instances[id]; d.state = loading_info_state_1.LoadingInfoState.NORMAL; }; LoadingInfoComponent.setOn = function (id, o) { var d = LoadingInfoComponent.instances[id]; if (d === undefined) { console.error("LoadinInfoCmp, setOn: '" + id + "' is undefinded"); return; } d.state = loading_info_state_1.LoadingInfoState.LOADING; o.subscribe(function () { d.state = loading_info_state_1.LoadingInfoState.NORMAL; }, function () { d.state = loading_info_state_1.LoadingInfoState.NORMAL; }); }; LoadingInfoComponent.prototype.ngOnInit = function () { if (!this.id) this.state = loading_info_state_1.LoadingInfoState.LOADING; LoadingInfoComponent.instances[this.id] = this; }; LoadingInfoComponent.instances = {}; __decorate([ core_1.Input(), __metadata('design:type', String) ], LoadingInfoComponent.prototype, "id", void 0); LoadingInfoComponent = __decorate([ core_1.Component({ selector: 'loading-info', template: require('./loading-info.component.html'), styles: [require('./loading-info.component.scss')] }), __metadata('design:paramtypes', []) ], LoadingInfoComponent); return LoadingInfoComponent; }()); exports.LoadingInfoComponent = LoadingInfoComponent; //# sourceMappingURL=loading-info.component.js.map