39 lines
889 B
JavaScript
39 lines
889 B
JavaScript
|
'use strict';
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.default = IndexSink;
|
||
|
|
||
|
var _Pipe = require('./Pipe');
|
||
|
|
||
|
var _Pipe2 = _interopRequireDefault(_Pipe);
|
||
|
|
||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
|
||
|
function IndexSink(i, sink) {
|
||
|
this.sink = sink;
|
||
|
this.index = i;
|
||
|
this.active = true;
|
||
|
this.value = void 0;
|
||
|
} /** @license MIT License (c) copyright 2010-2016 original author or authors */
|
||
|
/** @author Brian Cavalier */
|
||
|
/** @author John Hann */
|
||
|
|
||
|
IndexSink.prototype.event = function (t, x) {
|
||
|
if (!this.active) {
|
||
|
return;
|
||
|
}
|
||
|
this.value = x;
|
||
|
this.sink.event(t, this);
|
||
|
};
|
||
|
|
||
|
IndexSink.prototype.end = function (t, x) {
|
||
|
if (!this.active) {
|
||
|
return;
|
||
|
}
|
||
|
this.active = false;
|
||
|
this.sink.end(t, { index: this.index, value: x });
|
||
|
};
|
||
|
|
||
|
IndexSink.prototype.error = _Pipe2.default.prototype.error;
|