diff --git a/bower.json b/bower.json index cd2a984..1463331 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "asteroid", - "version": "0.3.5", + "version": "0.3.6", "homepage": "https://github.com/mondora/asteroid", "authors": [ "Paolo Scanferla " diff --git a/package.json b/package.json index 08c8e72..a53b30f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "asteroid", - "version": "0.3.5", + "version": "0.3.6", "description": "Aletrnative Meteor client", "main": "dist/node.asteroid.js", "scripts": { diff --git a/src/subscription.js b/src/subscription.js index bcf56e8..a286323 100644 --- a/src/subscription.js +++ b/src/subscription.js @@ -47,12 +47,14 @@ Subscription.prototype._onError = function (err) { Asteroid.prototype.subscribe = function (name /* , param1, param2, ... */) { // Assert arguments type must.beString(name); + // Collect arguments into array + var args = Array.prototype.slice.call(arguments); // Hash the arguments to get a key for _subscriptionsCache - var params = Array.prototype.slice.call(arguments, 1); - var hash = JSON.stringify(params); + var hash = JSON.stringify(args); // Only subscribe if there is no cached subscription if (!this._subscriptionsCache[hash]) { - // Collect arguments into array + // Get the parameters of the subscription + var params = args.slice(1); var sub = new Subscription(name, params, hash, this); this._subscriptionsCache[hash] = sub; this.subscriptions[sub.id] = sub;