UNPKG

@openhps/core

Version:

Open Hybrid Positioning System - Core component

55 lines 1.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GraphShapeNode = void 0; const Node_1 = require("../Node"); /** * Graph shape node is a node that contains multiple nodes on itself. Other than a constructed * graph shape, this type of node should offer a collection of nodes. An example could be a "PDRProcessingNode" * that performs pedestrian dead reckoning by combining multiple internal nodes, such as an AccelerationProcessing, * VelocityProcessingNode and StepDetection. */ class GraphShapeNode extends Node_1.Node { constructor(options) { super(options); this.once('build', this._onBuild.bind(this)); this.once('destroy', this._onDestroy.bind(this)); } _onBuild() { return new Promise((resolve, reject) => { this.construct(this._builder); this._builder .build() .then((graph) => { this._graph = graph; this._builder = null; resolve(); }) .catch(reject); }); } _onDestroy() { return this._graph.emitAsync('destroy'); } /** * Send a pull request to the node * @param {PullOptions} [options] Pull options * @returns {Promise<void>} Pull promise */ pull(options) { return this._graph.pull(options); } /** * Push data to the node * @param {DataFrame | DataFrame[]} data Data frame to push * @param {PushOptions} [options] Push options * @returns {PushPromise<void>} Push promise */ push(data, options = {}) { return this._graph.push(data, options); } get processingGraph() { return this._graph; } } exports.GraphShapeNode = GraphShapeNode; //# sourceMappingURL=GraphShapeNode.js.map