Import.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _react = _interopRequireDefault(require("react"));
  7. var _Logger = _interopRequireDefault(require("./Logger"));
  8. var _Module = _interopRequireDefault(require("../modules/Module"));
  9. var _Service = _interopRequireDefault(require("../modules/Service"));
  10. var _Systems = _interopRequireDefault(require("./Systems"));
  11. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  13. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  15. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  16. var Import =
  17. /*#__PURE__*/
  18. function () {
  19. function Import() {
  20. _classCallCheck(this, Import);
  21. }
  22. _createClass(Import, [{
  23. key: "import",
  24. value: function _import(obj, namespace) {
  25. for (var i in obj) {
  26. if (obj[i].prototype instanceof _Service.default) {
  27. if (namespace) obj[i].Namespace = namespace;
  28. _Systems.default.addService(obj[i]);
  29. } else if (obj[i].prototype instanceof _Module.default) {
  30. if (namespace) obj[i].Namespace = namespace;
  31. _Systems.default.addModule(obj[i]);
  32. } else if (_typeof(obj[i]) === "object") {
  33. this.import(obj[i], namespace);
  34. }
  35. }
  36. }
  37. }]);
  38. return Import;
  39. }();
  40. var _default = new Import();
  41. exports.default = _default;