// FIXME: Deprecate this, it does not work as-expected when the onResult callback never gets called (eg. due to a stream immediately terminating), as the onResult callback will then never get a chance to set the lastResult, not even to an initializer value (eg. an empty array for `collect`)
// We return whatever value we got last from the specified onResult callback.
returnlastResult;
})]
}
}
]);
]);
letlastResult;
// FIXME: Bump minor version!
letonEndCalled=false;
letonEndCalled=false;
letonEndResult;
letabortHandled=false;
letabortHandled=false;
letlastKnownSource;
letlastKnownSource;
letresultBuffer=createResultBuffer();
return{
return{
_promistreamVersion:0,
_promistreamVersion:0,
description:`simple sink stream`,
description:`simple sink stream`,
@ -45,14 +44,19 @@ module.exports = function simpleSinkStream(_options) {
returnsource.read();
returnsource.read();
}).then((value)=>{
}).then((value)=>{
// FIXME: Document that you can pause the sink from the onResult callback, by returning a Promise that resolves when it should be resumed
// FIXME: Document that you can pause the sink from the onResult callback, by returning a Promise that resolves when it should be resumed
returnonResult(value);
returnonResult(value, source.abort.bind(source));
}).then((result)=>{
}).then((result)=>{
lastResult=result;
// FIXME: Replace all instances of undefined checks with a standardized NoValue marker