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/sink/SafeSink.js

39 lines
732 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = SafeSink;
/** @license MIT License (c) copyright 2010-2016 original author or authors */
/** @author Brian Cavalier */
/** @author John Hann */
function SafeSink(sink) {
this.sink = sink;
this.active = true;
}
SafeSink.prototype.event = function (t, x) {
if (!this.active) {
return;
}
this.sink.event(t, x);
};
SafeSink.prototype.end = function (t, x) {
if (!this.active) {
return;
}
this.disable();
this.sink.end(t, x);
};
SafeSink.prototype.error = function (t, e) {
this.disable();
this.sink.error(t, e);
};
SafeSink.prototype.disable = function () {
this.active = false;
return this.sink;
};