UNPKG

bitfront-library

Version:

Angular CLI project with components and classes used by other Angular projects of the BIT foundation.

43 lines 1.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AyudaService = void 0; var core_1 = require("@angular/core"); var ayudacontextual_1 = require("../data/ayudacontextual"); var i0 = require("@angular/core"); var AyudaService = /** @class */ (function () { function AyudaService() { this.mostrar = new core_1.EventEmitter(); this.loadAyudas(); } // procesa el fichero app.ayudas.json y crea el mapa para acceder luego directamente por clave AyudaService.prototype.loadAyudas = function () { var _this = this; this.mapaAyudas = new Map(); if (AyudaService.AYUDAS) { AyudaService.AYUDAS.forEach(function (elem) { _this.mapaAyudas.set(elem.key, ayudacontextual_1.AyudaContextual.newObject(elem)); }); console.log("Cargadas " + this.mapaAyudas.size + " ayudas contextuales"); } else { console.warn("No se han podido cargar las ayudas contextuales de la aplicacion."); } }; AyudaService.prototype.mostrarAyuda = function (key) { if (this.mapaAyudas.has(key)) { this.mostrar.emit(this.mapaAyudas.get(key)); } else { console.warn("No existe ayuda para la clave [" + key + "]"); } }; AyudaService.AYUDAS = []; // Inicializar desde la aplicacion cliente AyudaService.ɵfac = function AyudaService_Factory(t) { return new (t || AyudaService)(); }; AyudaService.ɵprov = i0.ɵɵdefineInjectable({ token: AyudaService, factory: AyudaService.ɵfac }); return AyudaService; }()); exports.AyudaService = AyudaService; (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AyudaService, [{ type: core_1.Injectable }], function () { return []; }, null); })(); //# sourceMappingURL=ayuda.service.js.map