Improve key recognition on Callbacks

This commit is contained in:
Zixaphir 2015-01-12 21:43:19 -07:00
parent b80989fe30
commit b78bcc2488
3 changed files with 6 additions and 6 deletions

View File

@ -3121,8 +3121,7 @@
name = _arg.name, cb = _arg.cb; name = _arg.name, cb = _arg.cb;
if (this[name]) { if (this[name]) {
this.connect(name); this.connect(name);
} } else {
if (!this[name]) {
this.keys.push(name); this.keys.push(name);
} }
return this[name] = cb; return this[name] = cb;

View File

@ -3147,8 +3147,7 @@
name = _arg.name, cb = _arg.cb; name = _arg.name, cb = _arg.cb;
if (this[name]) { if (this[name]) {
this.connect(name); this.connect(name);
} } else {
if (!this[name]) {
this.keys.push(name); this.keys.push(name);
} }
return this[name] = cb; return this[name] = cb;

View File

@ -3,8 +3,10 @@ class Callbacks
@keys = [] @keys = []
push: ({name, cb}) -> push: ({name, cb}) ->
@connect name if @[name] if @[name]
@keys.push name unless @[name] @connect name
else
@keys.push name
@[name] = cb @[name] = cb
connect: (name) -> delete @[name].disconnected if @[name].disconnected connect: (name) -> delete @[name].disconnected if @[name].disconnected