node-red-contrib-vban
Version:
Nodes to interact with vban protocol
40 lines (39 loc) • 1.55 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.TechnicalNode = void 0;
class TechnicalNode {
constructor(nodeRED) {
this.nodeRED = nodeRED;
this.nodeConstructor = (node, definition) => {
this._node = node;
this._definition = definition;
this.nodeRED.nodes.createNode(node, definition);
this.init();
};
}
get definition() {
if (!this._definition) {
throw new Error(`can't retrieve definition before init`);
}
return this._definition;
}
get node() {
if (!this._node) {
throw new Error(`can't retrieve node before init`);
}
return this._node;
}
init() {
return __awaiter(this, void 0, void 0, function* () { });
}
}
exports.TechnicalNode = TechnicalNode;