UNPKG

@openhps/core

Version:

Open Hybrid Positioning System - Core component

29 lines 983 B
import { RemoteNode } from '../RemoteNode'; import { SinkNode } from '../SinkNode'; import { Edge } from '../../graph/Edge'; /** * Remote sink node */ export class RemoteSinkNode extends SinkNode { constructor(options) { var _a; super(options); this.remoteNode = new ((_a = options.type) !== null && _a !== void 0 ? _a : 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(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); } }