UNPKG

apisearch-ui

Version:

Javascript User Interface of Apisearch.

33 lines (32 loc) 748 B
"use strict"; exports.__esModule = true; /** * Apisearch Dependency Injection Container */ var Container = /** @class */ (function () { function Container() { this.services = {}; } /** * Get service * * @param id */ Container.prototype.get = function (id) { if (this.services[id]) { return this.services[id]; } throw new Error("Service with id (" + id + ") is not registered."); }; /** * Register service * * @param id * @param serviceCallback */ Container.prototype.register = function (id, serviceCallback) { this.services[id] = serviceCallback(); }; return Container; }()); exports["default"] = new Container;