This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/fablabchemnitz/papercraft/openjscad/node_modules/most/lib/combinator/timestamp.js

43 lines
1.0 KiB
JavaScript

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.timestamp = timestamp;
var _Stream = require('../Stream');
var _Stream2 = _interopRequireDefault(_Stream);
var _Pipe = require('../sink/Pipe');
var _Pipe2 = _interopRequireDefault(_Pipe);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/** @license MIT License (c) copyright 2010-2016 original author or authors */
/** @author Brian Cavalier */
/** @author John Hann */
function timestamp(stream) {
return new _Stream2.default(new Timestamp(stream.source));
}
function Timestamp(source) {
this.source = source;
}
Timestamp.prototype.run = function (sink, scheduler) {
return this.source.run(new TimestampSink(sink), scheduler);
};
function TimestampSink(sink) {
this.sink = sink;
}
TimestampSink.prototype.end = _Pipe2.default.prototype.end;
TimestampSink.prototype.error = _Pipe2.default.prototype.error;
TimestampSink.prototype.event = function (t, x) {
this.sink.event(t, { time: t, value: x });
};