UNPKG

nope-js-browser

Version:

NoPE Runtime for the Browser. For nodejs please use nope-js-node

30 lines (29 loc) 855 B
/** * @author Martin Karkowski * @email m.karkowski@zema.de * @desc [description] */ import { getCentralDecoratedContainer, } from "./container"; const CONTAINER = getCentralDecoratedContainer(); /** * Decorator, that will export the Function to a Dispatcher * @param func The Function * @param options The Options. */ export 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; }