UNPKG

@aca-1/a2-composer

Version:
71 lines 2.73 kB
import { Injectable } from '@angular/core'; import { COMPOSER } from '../settings'; var ComposerDebugService = (function () { function ComposerDebugService() { this.services = {}; COMPOSER.log('DEBUG', 'Injected'); var win = self; if (!win.$aca) { win.$aca = {}; } win.$aca.composer = this; } ComposerDebugService.prototype.cmd = function (cmd, data) { if (COMPOSER.get('debug')) { switch (cmd.toLowerCase()) { case 'help': this.help(); break; case 'service': COMPOSER.log('DEBUG', "Running command 'service'..."); if (typeof data === 'string') { return this.services[data.toLowerCase()]; } break; case 'bindings': return this.bindings(data); case 'exec': return this.exec(data); default: COMPOSER.log('DEBUG', "Unknown command '" + cmd + "'. Use 'help' to get a list of commands."); break; } } else { COMPOSER.error('DEBUG', 'Debug mode is disabled.'); } return {}; }; ComposerDebugService.prototype.bindings = function (sys) { if (COMPOSER.get('debug')) { COMPOSER.log('DEBUG', "Running command 'bindings'..."); } else { COMPOSER.error('DEBUG', 'Debug mode is disabled.'); } }; ComposerDebugService.prototype.exec = function (options) { if (COMPOSER.get('debug')) { COMPOSER.log('DEBUG', "Running command 'exec'..."); } else { COMPOSER.error('DEBUG', 'Debug mode is disabled.'); } }; ComposerDebugService.prototype.help = function () { if (COMPOSER.get('debug')) { COMPOSER.log('DEBUG', 'Running command help...'); COMPOSER.log('DEBUG', "\n Available commands:\n help - Lists the available commands for composer debug.\n service - Returns given service. Available services: Comms, Resources, Store, Systems.\n bindings - Lists the bindings on the given system.\n exec - Executes a function on the given system."); } else { COMPOSER.error('DEBUG', 'Debug mode is disabled.'); } }; return ComposerDebugService; }()); export { ComposerDebugService }; ComposerDebugService.decorators = [ { type: Injectable }, ]; ComposerDebugService.ctorParameters = function () { return []; }; //# sourceMappingURL=debug.service.js.map