Skip to content

Commit

Permalink
fix(changeStreams): fixing node4 issue with util.inherits (#1587)
Browse files Browse the repository at this point in the history
require('util').inherits(ctor, super) blows away the original prototype
of ctor. If we wish to use it, we need to move the inherits call to
directly after the constructor creation. In the future, we should
switch to using classes.
  • Loading branch information
daprahamian authored Nov 29, 2017
1 parent f4c1b56 commit 168bb3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/change_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ var ChangeStream = function(collection, pipeline, options) {
});
};

inherits(ChangeStream, EventEmitter);

// Create a new change stream cursor based on self's configuration
var createChangeStreamCursor = function(self) {
if (self.resumeToken) {
Expand Down Expand Up @@ -354,6 +356,4 @@ var processNewChange = function(self, err, change, callback) {
* @param {(object|null)} result The result object if the command was executed successfully.
*/

inherits(ChangeStream, EventEmitter);

module.exports = ChangeStream;

0 comments on commit 168bb3d

Please sign in to comment.