Skip to content

Commit

Permalink
optimize variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
uxder committed Dec 27, 2011
1 parent bacf9e6 commit 5d3d42b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand Down

0 comments on commit 5d3d42b

Please sign in to comment.