lemon-core
Version:
Lemon Serverless Micro-Service Platform
48 lines • 2.07 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProtocolModule = void 0;
/**
* `cores/config.index.tx`
* - config services for serverless micro-service.
*
*
* @author Steve Jung <steve@lemoncloud.io>
* @date 2018-05-23 initial version
* @date 2019-11-26 cleanup and optimized for `lemon-core#v2`
*
* @copyright (C) lemoncloud.io 2019 - All Rights Reserved.
*/
const engine_1 = require("../../engine/");
const protocol_service_1 = require("./protocol-service");
class ProtocolModule {
constructor(engine) {
//! create default services
this.service = new protocol_service_1.MyProtocolService();
this.getModuleName = () => 'protocol';
this.engine = engine || engine_1.$engine; // use input engine or global.
if (this.engine)
this.engine.register(this);
}
initModule(level) {
return __awaiter(this, void 0, void 0, function* () {
const $conf = this.engine.module('config');
if (level === undefined) {
return $conf ? (yield $conf.initModule()) + 1 : 1;
}
// console.info(`! ProtocolModule.init()..`);
});
}
}
exports.ProtocolModule = ProtocolModule;
//! create default instance, then export as default.
exports.default = new ProtocolModule();
//# sourceMappingURL=index.js.map
;