From 21a3b7d6595469181097c1de21775c506b7611e3 Mon Sep 17 00:00:00 2001 From: Hassan Abdel-Rahman Date: Fri, 10 Jun 2016 22:24:00 -0400 Subject: [PATCH 1/4] added the ability to add mulitple subscribers --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 176fceb..d53e880 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,7 @@ class S3Notifier { this.ui = options.ui; this.bucket = options.bucket; this.key = options.key; + this.notifers = []; this.pollTime = options.poll || DEFAULT_POLL_TIME; this.params = { @@ -22,7 +23,7 @@ class S3Notifier { } subscribe(notify) { - this.notify = notify; + this.notifiers.push(notify); return this.getCurrentLastModified() .then(() => this.schedulePoll()); @@ -56,7 +57,7 @@ class S3Notifier { if (newLastModified !== this.lastModified) { this.ui.writeLine('config modified; old=%s; new=%s', this.lastModified, newLastModified); this.lastModified = newLastModified; - this.notify(); + this.notifiers.forEach(notifier => notifier(newLastModified)); } } } From 819565936956c1cc63ab7187bda76208da17472d Mon Sep 17 00:00:00 2001 From: Hassan Abdel-Rahman Date: Fri, 10 Jun 2016 23:38:27 -0400 Subject: [PATCH 2/4] typo --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index d53e880..b6b1407 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,7 @@ class S3Notifier { this.ui = options.ui; this.bucket = options.bucket; this.key = options.key; - this.notifers = []; + this.notifiers = []; this.pollTime = options.poll || DEFAULT_POLL_TIME; this.params = { From 474290e75ffb75205f6579078e67ddf3b17cdea3 Mon Sep 17 00:00:00 2001 From: Hassan Abdel-Rahman Date: Fri, 24 Mar 2017 20:39:58 -0400 Subject: [PATCH 3/4] Fixes #4 converts dates to strings before comparing them --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 83242d7..3509f9e 100644 --- a/index.js +++ b/index.js @@ -54,7 +54,7 @@ class S3Notifier { } compareLastModifieds(newLastModified) { - if (newLastModified !== this.lastModified) { + if ((newLastModified + '') !== (this.lastModified + '')) { this.ui.writeLine('config modified; old=%s; new=%s', this.lastModified, newLastModified); this.lastModified = newLastModified; this.notify(); From e3ece474801f9a9fbbb72491e63364bdf838698e Mon Sep 17 00:00:00 2001 From: Hassan Abdel-Rahman Date: Fri, 24 Mar 2017 20:46:07 -0400 Subject: [PATCH 4/4] bump version to make yarn happy --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b269da1..ae58cd7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fastboot-s3-notifier", - "version": "0.1.1", + "version": "0.1.2", "description": "A FastBoot App Server notifier for AWS S3", "main": "index.js", "scripts": {