From 479c0a4895f4d3beeeb181afc485c5aeec1d95f0 Mon Sep 17 00:00:00 2001 From: Marshall Rose Date: Thu, 15 May 2014 10:08:36 -0700 Subject: [PATCH 1/2] do not use an instantiated Instapush() as the exports value otherwise when require'd, the caller can not make more than one Instapush object --- lib/index.js | 11 ++++++++++- package.json | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 97bd09c..708a7ec 100644 --- a/lib/index.js +++ b/lib/index.js @@ -135,5 +135,14 @@ Instapush.prototype.addApp = function (data, callback) { /** * Export */ -module.exports = new Instapush(); +// module.exports = new Instapush(); +// respectfully: the above line is unfortunate, as it prevents the creation of multiple Instapush objects +module.exports = Instapush; + +/* to be backwards compatible with 1.0.1, callers should use: + + var instapush = require('instapush'); + if (typeof instapush === 'function') instapush = new instapush(); + + */ diff --git a/package.json b/package.json index 26df97a..69db69a 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "api", "client" ], - "version": "1.0.1", + "version": "1.1.0", "main": "lib/index.js", "dependencies": { "request": "~2.12.0" From f8442e9f5f0e76a3fcb6f172e89190baf277ae00 Mon Sep 17 00:00:00 2001 From: Marshall Rose Date: Thu, 15 May 2014 21:11:17 -0700 Subject: [PATCH 2/2] comment out console.log statement --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 708a7ec..d397750 100644 --- a/lib/index.js +++ b/lib/index.js @@ -60,7 +60,7 @@ Instapush.prototype.request = function (method, url,data, callback) { headers: headers, json: data }, function (err, response, body) { - console.log(protocole+'://'+self.url+'/'+self.version+'' + url); +// console.log(protocole+'://'+self.url+'/'+self.version+'' + url); if (err) return callback(err); if (response.code < 200 || response.code > 302) return callback(body); callback(null, body);