Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | 34x 34x 34x 34x 34x 34x 34x 34x 34x 782x 782x 782x 782x 782x 782x 612x 782x 34x 544x 544x 102x 102x 442x | import log from './../log.js'; import CommandsManager from '../classes/CommandsManager'; import ExtensionManager from '../extensions/ExtensionManager'; export default class ServicesManager { public services: AppTypes.Services = {}; public registeredServiceNames: string[] = []; private _commandsManager: CommandsManager; private _extensionManager: ExtensionManager; constructor(commandsManager: CommandsManager) { this._commandsManager = commandsManager; this._extensionManager = null; this.services = {}; this.registeredServiceNames = []; } public setExtensionManager(extensionManager) { this._extensionManager = extensionManager; } /** * Registers a new service. * * @param {Object} service * @param {Object} configuration */ public registerService(service, configuration = {}) { Iif (!service) { log.warn('Attempting to register a null/undefined service. Exiting early.'); return; } Iif (!service.name) { log.warn(`Service name not set. Exiting early.`); return; } Iif (this.registeredServiceNames.includes(service.name)) { log.warn( `Service name ${service.name} has already been registered. Exiting before duplicating services.` ); return; } if (service.create) { this.services[service.name] = service.create({ configuration, extensionManager: this._extensionManager, commandsManager: this._commandsManager, servicesManager: this, }); if (service.altName) { // TODO - remove this registration this.services[service.altName] = this.services[service.name]; } } else E{ log.warn(`Service create factory function not defined. Exiting early.`); return; } /* Track service registration */ this.registeredServiceNames.push(service.name); } /** * An array of services, or an array of arrays that contains service * configuration pairs. * * @param {Object[]} services - Array of services */ public registerServices(services) { services.forEach(service => { const hasConfiguration = Array.isArray(service); if (hasConfiguration) { const [ohifService, configuration] = service; this.registerService(ohifService, configuration); } else { this.registerService(service); } }); } } |