Browse files

optimize variable.

  • Loading branch information...
1 parent bacf9e6 commit 5d3d42b610037c742ae3d4ac1f4518c0e933f8d4 @uxder committed Dec 27, 2011
Showing with 4 additions and 6 deletions.
  1. +4 −6 radio.js
View
10 radio.js
@@ -75,18 +75,16 @@
*/
add: function() {
var a = arguments,
- c = this.channels,
- cn = this.channelName,
- i, l = a.length,
- channel;
+ c = this.channels[this.channelName],
+ i, l = a.length, p, ai = [];
//run through each arguments and add it to the channel
for (i = 0; i < l; i++) {
- var p, ai = a[i];
+ ai = a[i];
//add accepts either an array (fucntion, context) or just the function.
//if the user send just a function, wrap the fucntion in an array [function]
p = (typeof(ai) === "function") ? [ai] : ai;
- if ((typeof(p) === 'object') && (p.length)) c[cn].push(p);
+ if ((typeof(p) === 'object') && (p.length)) c.push(p);
}
return this;
},

0 comments on commit 5d3d42b

Please sign in to comment.