posthog-js 1.29.2 → 1.29.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/es.js +20 -11
- package/dist/es.js.map +1 -1
- package/dist/module.js +20 -11
- package/dist/module.js.map +1 -1
- package/lib/package.json +9 -9
- package/package.json +9 -9
package/dist/es.js
CHANGED
|
@@ -881,7 +881,7 @@ var LZString = {
|
|
|
881
881
|
}
|
|
882
882
|
};
|
|
883
883
|
|
|
884
|
-
var version = "1.29.
|
|
884
|
+
var version = "1.29.3";
|
|
885
885
|
|
|
886
886
|
// e.g. Config.DEBUG = Config.DEBUG || instance.get_config('debug')
|
|
887
887
|
|
|
@@ -4341,19 +4341,27 @@ var RequestQueue = /*#__PURE__*/function (_RequestQueueScaffold) {
|
|
|
4341
4341
|
}, {
|
|
4342
4342
|
key: "unload",
|
|
4343
4343
|
value: function unload() {
|
|
4344
|
+
var _this3 = this;
|
|
4345
|
+
|
|
4344
4346
|
clearTimeout(this._poller);
|
|
4345
4347
|
var requests = this._event_queue.length > 0 ? this.formatQueue() : {};
|
|
4346
4348
|
this._event_queue.length = 0;
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4349
|
+
var requestValues = Object.values(requests); // Always force events to be sent before recordings, as events are more important, and recordings are bigger and thus less likely to arrive
|
|
4350
|
+
|
|
4351
|
+
var sortedRequests = [].concat(_toConsumableArray(requestValues.filter(function (r) {
|
|
4352
|
+
return r.url.indexOf('/e') === 0;
|
|
4353
|
+
})), _toConsumableArray(requestValues.filter(function (r) {
|
|
4354
|
+
return r.url.indexOf('/e') !== 0;
|
|
4355
|
+
})));
|
|
4356
|
+
sortedRequests.map(function (_ref) {
|
|
4357
|
+
var url = _ref.url,
|
|
4358
|
+
data = _ref.data,
|
|
4359
|
+
options = _ref.options;
|
|
4360
|
+
|
|
4361
|
+
_this3.handlePollRequest(url, data, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
4354
4362
|
transport: 'sendBeacon'
|
|
4355
4363
|
}));
|
|
4356
|
-
}
|
|
4364
|
+
});
|
|
4357
4365
|
}
|
|
4358
4366
|
}, {
|
|
4359
4367
|
key: "formatQueue",
|
|
@@ -6128,10 +6136,11 @@ var PostHog = /*#__PURE__*/function () {
|
|
|
6128
6136
|
distinct_id: uuid,
|
|
6129
6137
|
$device_id: uuid
|
|
6130
6138
|
}, '');
|
|
6131
|
-
} // Set up
|
|
6139
|
+
} // Set up event handler for pageleave
|
|
6140
|
+
// Use `onpagehide` if available, see https://calendar.perfplanet.com/2020/beaconing-in-practice/#beaconing-reliability-avoiding-abandons
|
|
6132
6141
|
|
|
6133
6142
|
|
|
6134
|
-
win.addEventListener && win.addEventListener('unload', this._handle_unload.bind(this));
|
|
6143
|
+
win.addEventListener && win.addEventListener('onpagehide' in self ? 'pagehide' : 'unload', this._handle_unload.bind(this));
|
|
6135
6144
|
} // Private methods
|
|
6136
6145
|
|
|
6137
6146
|
}, {
|