UNPKG

@aca-1/a2-composer

Version:
86 lines 3.36 kB
import { Observable } from 'rxjs/Observable'; var COMPOSER = (function () { function COMPOSER() { } COMPOSER.get = function (name) { return this.data[name]; }; COMPOSER.observe = function (var_name) { if (!COMPOSER.obs[var_name]) { COMPOSER.obs[var_name] = new Observable(function (observer) { COMPOSER._obs[var_name] = observer; setTimeout(function () { COMPOSER._obs[var_name].next(COMPOSER.data[var_name]); }, 200); }); } return COMPOSER.obs[var_name]; }; COMPOSER.loadSettings = function () { var globalScope = self; if (globalScope) { var _loop_1 = function (i) { if (globalScope[i] !== undefined && (COMPOSER.data[i] === undefined || globalScope[i] !== COMPOSER.data[i])) { COMPOSER.data[i] = globalScope[i]; if (!COMPOSER.obs[i] || !COMPOSER._obs[i]) { COMPOSER.obs[i] = new Observable(function (observer) { COMPOSER._obs[i] = observer; COMPOSER._obs[i].next(COMPOSER.data[i]); }); } else if (COMPOSER._obs[i]) { COMPOSER._obs[i].next(COMPOSER.data[i]); } } }; for (var _i = 0, _a = COMPOSER.var_list; _i < _a.length; _i++) { var i = _a[_i]; _loop_1(i); } if (globalScope.systemData) { COMPOSER.data.control = globalScope.systemData; } else if (globalScope.systemsData) { COMPOSER.data.control = globalScope.systemsData; } else if (globalScope.control && globalScope.control.systems) { COMPOSER.data.control = globalScope.control.systems; } } }; COMPOSER.log = function (type, msg, args, out, color) { if (out === void 0) { out = 'debug'; } if (COMPOSER.data && COMPOSER.data.debug) { var clr = color ? color : '#009688'; var COLOURS = ['color: #0288D1', "color:" + clr, 'color:rgba(0,0,0,0.87)']; if (args) { console[out].apply(console, ["%c[COMPOSER]%c[" + type + "] %c" + msg].concat(COLOURS, [args])); } else { console[out].apply(console, ["%c[COMPOSER]%c[" + type + "] %c" + msg].concat(COLOURS)); } } }; COMPOSER.error = function (type, msg, args) { COMPOSER.log(type, msg, args, 'error'); }; COMPOSER.version = function (version, build, out) { if (out === void 0) { out = 'debug'; } var COLOURS = ['color: #f44336', "color: #9c27b0", 'color:rgba(0,0,0,0.87)']; console[out].apply(console, ["%c[ACA]%c[LIBRARY] %cComposer - Version: " + version + " | Build: " + build].concat(COLOURS)); }; return COMPOSER; }()); export { COMPOSER }; COMPOSER.var_list = ['debug']; COMPOSER.data = {}; COMPOSER.obs = {}; COMPOSER._obs = {}; setTimeout(function () { COMPOSER.loadSettings(); setInterval(function () { COMPOSER.loadSettings(); }, 1000); }, 50); //# sourceMappingURL=settings.js.map