From 7abd6b0d62f4417fd613ddfee5c3ac1323409b64 Mon Sep 17 00:00:00 2001 From: Pavel Kornilov Date: Fri, 26 Dec 2014 18:14:47 +0300 Subject: [PATCH] refactor .once --- index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/index.js b/index.js index ad71163..6c45592 100644 --- a/index.js +++ b/index.js @@ -58,11 +58,8 @@ Emitter.prototype.addEventListener = function(event, fn){ */ Emitter.prototype.once = function(event, fn){ - var self = this; - this._callbacks = this._callbacks || {}; - function on() { - self.off(event, on); + this.off(event, on); fn.apply(this, arguments); }