nope-js-node
Version:
NoPE Runtime for Nodejs. For Browser-Support please use nope-browser
36 lines (35 loc) • 1.46 kB
JavaScript
;
/**
* @author Martin Karkowski
* @email m.karkowski@zema.de
* @create date 2021-03-23 07:30:19
* @modify date 2022-01-03 17:33:58
* @desc [description]
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLayer = void 0;
const idMethods_1 = require("../helpers/idMethods");
const addLayer_nodejs_1 = require("./addLayer.nodejs");
const bridge_1 = require("./bridge");
/**
* Function, that will create a Bridge, based on the provided function.
* Based on the parameter "layer", a corresponding layer or mirror will
* be added to the bridge. You can provide custom parameters using the
* parameter "parameter". This will receive either the uri or ports.
* Additionally you are able to assign a log-level to the bridge.
*
* @export
* @param {validLayerOrMirror} layer the layer to add
* @param {(number | string)} [parameter=null] the parameter required for the additonal layer / mirror
* @param {LoggerLevel} [logger=false] the level of the debugger
* @return {ICommunicationBridge} A bridge
*/
function getLayer(layer, parameter = null, logger = false) {
// Create the Bridge
const communicationBridge = new bridge_1.Bridge((0, idMethods_1.generateId)(), logger);
// Add the Logger.
(0, addLayer_nodejs_1.addLayer)(communicationBridge, layer, parameter, logger, true);
// Return the Bridge
return communicationBridge;
}
exports.getLayer = getLayer;