mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
stream: update comment to indicate unused API
destroy w/ callback was previously used by node core. This is no longer the case and the comments should reflect this to avoid confusion. PR-URL: https://github.com/nodejs/node/pull/32808 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
1 parent
d1b41bbd86
commit
6e5c23b6c8
1 file changed
+2
-4
@@ -1,15 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
// Undocumented cb() API, needed for core, not for public API.
|
||||
// The cb() will be invoked synchronously if _destroy is synchronous.
|
||||
// If cb is passed no 'error' event will be emitted.
|
||||
// Backwards compat. cb() is undocumented and unused in core but
|
||||
// unfortunately might be used by modules.
|
||||
function destroy(err, cb) {
|
||||
const r = this._readableState;
|
||||
const w = this._writableState;
|
||||
|
||||
if ((w && w.destroyed) || (r && r.destroyed)) {
|
||||
if (typeof cb === 'function') {
|
||||
// TODO(ronag): Invoke with `'close'`/`'error'`.
|
||||
cb();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user