UNPKG

nope-js-node

Version:

NoPE Runtime for Nodejs. For Browser-Support please use nope-browser

34 lines (33 loc) 1.02 kB
"use strict"; /** * @author Martin Karkowski * @email m.karkowski@zema.de * @desc [description] */ Object.defineProperty(exports, "__esModule", { value: true }); exports.exportAsNopeService = void 0; const container_1 = require("./container"); const CONTAINER = (0, container_1.getCentralDecoratedContainer)(); /** * Decorator, that will export the Function to a Dispatcher * @param func The Function * @param options The Options. */ function exportAsNopeService(func, options) { // Only add the element if it doesnt exists. if (!CONTAINER.services.has(options.id)) { if (options.ui === undefined && options.schema) { options.ui = { autoGenBySchema: true, }; } CONTAINER.services.set(options.id, { callback: func, options, uri: options.id || func.name, }); } func.options = options; return func; } exports.exportAsNopeService = exportAsNopeService;