From 77ec310d0ccb81fb1c44a4a798ea37e675597621 Mon Sep 17 00:00:00 2001 From: solebox <5013box@gmail.com> Date: Tue, 1 Nov 2016 01:11:18 +0200 Subject: [PATCH] zlib: name every function Ref: #8913 PR-URL: https://github.com/nodejs/node/pull/9389 Reviewed-By: Roman Reiss Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- lib/zlib.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/zlib.js b/lib/zlib.js index bdce0c8d7f2eec..ce68e9cd105de0 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -346,7 +346,7 @@ function Zlib(opts, mode) { var self = this; this._hadError = false; - this._handle.onerror = function(message, errno) { + this._handle.onerror = function onErrorHandler(message, errno) { // there is no way to cleanly recover. // continuing only obscures problems. _close(self); @@ -401,7 +401,7 @@ Zlib.prototype.params = function(level, strategy, callback) { if (this._level !== level || this._strategy !== strategy) { var self = this; - this.flush(constants.Z_SYNC_FLUSH, function() { + this.flush(constants.Z_SYNC_FLUSH, function flushCallback() { assert(self._handle, 'zlib binding closed'); self._handle.params(level, strategy); if (!self._hadError) { @@ -442,7 +442,8 @@ Zlib.prototype.flush = function(kind, callback) { this.once('end', callback); } else if (ws.needDrain) { if (callback) { - this.once('drain', () => this.flush(kind, callback)); + const drainHandler = () => this.flush(kind, callback); + this.once('drain', drainHandler); } } else { this._flushFlag = kind;