From 610e00ee21a1b5e8620485a983bf20588674061e Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 31 Jan 2015 12:32:33 -0800 Subject: [PATCH] use emitter.setMaxListeners(). --- lib/events.js | 4 ++++ lib/widget.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/events.js b/lib/events.js index af5cb7a..87f2b03 100644 --- a/lib/events.js +++ b/lib/events.js @@ -14,6 +14,10 @@ function EventEmitter() { if (!this._events) this._events = {}; } +EventEmitter.prototype.setMaxListeners = function(n) { + this._maxListeners = n; +}; + EventEmitter.prototype.addListener = function(type, listener) { if (!this._events[type]) { this._events[type] = listener; diff --git a/lib/widget.js b/lib/widget.js index 8313264..58e0972 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -354,7 +354,8 @@ function Screen(options) { this.enter(); - this._maxListeners = Infinity; + // XXX Not used right now since we're using our own EventEmitter: + this.setMaxListeners(Infinity); Screen.total++;