@openhps/core
Version:
Open Hybrid Positioning System - Core component
34 lines • 1.28 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RemoteSinkNode = void 0;
const RemoteNode_1 = require("../RemoteNode");
const SinkNode_1 = require("../SinkNode");
const Edge_1 = require("../../graph/Edge");
/**
* Remote sink node
*/
class RemoteSinkNode extends SinkNode_1.SinkNode {
constructor(options) {
var _a;
super(options);
this.remoteNode = new ((_a = options.type) !== null && _a !== void 0 ? _a : RemoteNode_1.RemoteNode)(options, this);
this.uid = `${this.uid}-sink`;
this.once('build', this._onRemoteBuild.bind(this));
this.once('destroy', this._onRemoteDestroy.bind(this));
}
_onRemoteBuild(graphBuilder) {
this.remoteNode.graph = this.graph;
graphBuilder.addNode(this.remoteNode);
graphBuilder.addEdge(new Edge_1.Edge(this, this.remoteNode));
return this.remoteNode.emitAsync('build', graphBuilder);
}
_onRemoteDestroy() {
return this.remoteNode.emitAsync('destroy');
}
onPush(data, options) {
// Force push to remote node, sink nodes do not push by default
return this.remoteNode.push(data, options);
}
}
exports.RemoteSinkNode = RemoteSinkNode;
//# sourceMappingURL=RemoteSinkNode.js.map