Skip to content

Commit 2fdf120

Browse files
committed
update from master
2 parents 71f3c31 + d024adc commit 2fdf120

File tree

11 files changed

+70
-12
lines changed

11 files changed

+70
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
## Unreleased
22

33
* Add support for user properties operations (set, setOnce, add, unset).
4+
5+
## 2.4.1 (September 21, 2015)
6+
47
* Add support for passing callback function to init.
58
* Fix bug to check that Window localStorage is available for use.
9+
* Fix bug to prevent scheduling multiple event uploads.
610

711
## 2.4.0 (September 4, 2015)
812

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Amplitude-Javascript
99

1010
<script type="text/javascript">
1111
(function(e,t){var r=e.amplitude||{};var n=t.createElement("script");n.type="text/javascript";
12-
n.async=true;n.src="https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-2.4.0-min.gz.js";
12+
n.async=true;n.src="https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-2.4.1-min.gz.js";
1313
var s=t.getElementsByTagName("script")[0];s.parentNode.insertBefore(n,s);r._q=[];function a(e){
1414
r[e]=function(){r._q.push([e].concat(Array.prototype.slice.call(arguments,0)))}}var i=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties"];
1515
for(var o=0;o<i.length;o++){a(i[o])}e.amplitude=r})(window,document);

amplitude-snippet.min.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(function(e,t){var r=e.amplitude||{};var n=t.createElement("script");n.type="text/javascript";
2-
n.async=true;n.src="https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-2.4.0-min.gz.js";
2+
n.async=true;n.src="https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-2.4.1-min.gz.js";
33
var s=t.getElementsByTagName("script")[0];s.parentNode.insertBefore(n,s);r._q=[];function a(e){
44
r[e]=function(){r._q.push([e].concat(Array.prototype.slice.call(arguments,0)))}}var i=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties"];
55
for(var o=0;o<i.length;o++){a(i[o])}e.amplitude=r})(window,document);

amplitude.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ Amplitude.prototype._sending = false;
174174
Amplitude.prototype._lastEventTime = null;
175175
Amplitude.prototype._sessionId = null;
176176
Amplitude.prototype._newSession = false;
177+
Amplitude.prototype._updateScheduled = false;
177178

178179
Amplitude.prototype.Identify = Identify;
179180

@@ -315,7 +316,16 @@ Amplitude.prototype._sendEventsIfReady = function(callback) {
315316
return true;
316317
}
317318

318-
setTimeout(this.sendEvents.bind(this), this.options.eventUploadPeriodMillis);
319+
if (!this._updateScheduled) {
320+
this._updateScheduled = true;
321+
setTimeout(
322+
function() {
323+
this._updateScheduled = false;
324+
this.sendEvents();
325+
}.bind(this), this.options.eventUploadPeriodMillis
326+
);
327+
}
328+
319329
return false;
320330
};
321331

@@ -3264,7 +3274,7 @@ module.exports = uuid;
32643274

32653275
}, {}],
32663276
12: [function(require, module, exports) {
3267-
module.exports = '2.4.0';
3277+
module.exports = '2.4.1';
32683278

32693279
}, {}],
32703280
13: [function(require, module, exports) {

amplitude.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"main": "src/index.js",
44
"repo": "amplitude/amplitude-javascript",
55
"description": "Javascript library for Amplitude Analytics",
6-
"version": "2.4.0",
6+
"version": "2.4.1",
77
"keywords": [
88
"analytics",
99
"amplitude"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "amplitude-js",
33
"author": "Amplitude <support@amplitude.com>",
4-
"version": "2.4.0",
4+
"version": "2.4.1",
55
"license": "MIT",
66
"description": "Javascript library for Amplitude Analytics",
77
"keywords": [

src/amplitude-snippet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var as = document.createElement('script');
44
as.type = 'text/javascript';
55
as.async = true;
6-
as.src = 'https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-2.4.0-min.gz.js';
6+
as.src = 'https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-2.4.1-min.gz.js';
77
var s = document.getElementsByTagName('script')[0];
88
s.parentNode.insertBefore(as, s);
99
amplitude._q = [];

src/amplitude.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Amplitude.prototype._sending = false;
6262
Amplitude.prototype._lastEventTime = null;
6363
Amplitude.prototype._sessionId = null;
6464
Amplitude.prototype._newSession = false;
65+
Amplitude.prototype._updateScheduled = false;
6566

6667
Amplitude.prototype.Identify = Identify;
6768

@@ -203,7 +204,16 @@ Amplitude.prototype._sendEventsIfReady = function(callback) {
203204
return true;
204205
}
205206

206-
setTimeout(this.sendEvents.bind(this), this.options.eventUploadPeriodMillis);
207+
if (!this._updateScheduled) {
208+
this._updateScheduled = true;
209+
setTimeout(
210+
function() {
211+
this._updateScheduled = false;
212+
this.sendEvents();
213+
}.bind(this), this.options.eventUploadPeriodMillis
214+
);
215+
}
216+
207217
return false;
208218
};
209219

src/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = '2.4.0';
1+
module.exports = '2.4.1';

0 commit comments

Comments
 (0)