From b78bcc2488a0c5357f924933124e89226b63c25a Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Mon, 12 Jan 2015 21:43:19 -0700 Subject: [PATCH] Improve key recognition on Callbacks --- builds/appchan-x.user.js | 3 +-- builds/crx/script.js | 3 +-- src/General/lib/callbacks.class | 6 ++++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 1b22260eb..e0ee4d8b2 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -3121,8 +3121,7 @@ name = _arg.name, cb = _arg.cb; if (this[name]) { this.connect(name); - } - if (!this[name]) { + } else { this.keys.push(name); } return this[name] = cb; diff --git a/builds/crx/script.js b/builds/crx/script.js index 1cb6f00f7..39cf15d0d 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -3147,8 +3147,7 @@ name = _arg.name, cb = _arg.cb; if (this[name]) { this.connect(name); - } - if (!this[name]) { + } else { this.keys.push(name); } return this[name] = cb; diff --git a/src/General/lib/callbacks.class b/src/General/lib/callbacks.class index 11cac8b55..b36187957 100644 --- a/src/General/lib/callbacks.class +++ b/src/General/lib/callbacks.class @@ -3,8 +3,10 @@ class Callbacks @keys = [] push: ({name, cb}) -> - @connect name if @[name] - @keys.push name unless @[name] + if @[name] + @connect name + else + @keys.push name @[name] = cb connect: (name) -> delete @[name].disconnected if @[name].disconnected