UNPKG

@thewtex/vtk.js-esm

Version:

Visualization Toolkit for the Web

29 lines (25 loc) 882 B
import { u as utils } from '../utils.js'; import { G as GenericWorker_1 } from './GenericWorker.js'; /** * A worker which calculate the total length of the data flowing through. * @constructor * @param {String} propName the name used to expose the length */ function DataLengthProbe(propName) { GenericWorker_1.call(this, "DataLengthProbe for " + propName); this.propName = propName; this.withStreamInfo(propName, 0); } utils.inherits(DataLengthProbe, GenericWorker_1); /** * @see GenericWorker.processChunk */ DataLengthProbe.prototype.processChunk = function (chunk) { if(chunk) { var length = this.streamInfo[this.propName] || 0; this.streamInfo[this.propName] = length + chunk.data.length; } GenericWorker_1.prototype.processChunk.call(this, chunk); }; var DataLengthProbe_1 = DataLengthProbe; export { DataLengthProbe_1 as D };