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/module.js
CHANGED
|
@@ -885,7 +885,7 @@ var LZString = {
|
|
|
885
885
|
}
|
|
886
886
|
};
|
|
887
887
|
|
|
888
|
-
var version = "1.29.
|
|
888
|
+
var version = "1.29.3";
|
|
889
889
|
|
|
890
890
|
// e.g. Config.DEBUG = Config.DEBUG || instance.get_config('debug')
|
|
891
891
|
|
|
@@ -4345,19 +4345,27 @@ var RequestQueue = /*#__PURE__*/function (_RequestQueueScaffold) {
|
|
|
4345
4345
|
}, {
|
|
4346
4346
|
key: "unload",
|
|
4347
4347
|
value: function unload() {
|
|
4348
|
+
var _this3 = this;
|
|
4349
|
+
|
|
4348
4350
|
clearTimeout(this._poller);
|
|
4349
4351
|
var requests = this._event_queue.length > 0 ? this.formatQueue() : {};
|
|
4350
4352
|
this._event_queue.length = 0;
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4353
|
+
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
|
|
4354
|
+
|
|
4355
|
+
var sortedRequests = [].concat(_toConsumableArray(requestValues.filter(function (r) {
|
|
4356
|
+
return r.url.indexOf('/e') === 0;
|
|
4357
|
+
})), _toConsumableArray(requestValues.filter(function (r) {
|
|
4358
|
+
return r.url.indexOf('/e') !== 0;
|
|
4359
|
+
})));
|
|
4360
|
+
sortedRequests.map(function (_ref) {
|
|
4361
|
+
var url = _ref.url,
|
|
4362
|
+
data = _ref.data,
|
|
4363
|
+
options = _ref.options;
|
|
4364
|
+
|
|
4365
|
+
_this3.handlePollRequest(url, data, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
4358
4366
|
transport: 'sendBeacon'
|
|
4359
4367
|
}));
|
|
4360
|
-
}
|
|
4368
|
+
});
|
|
4361
4369
|
}
|
|
4362
4370
|
}, {
|
|
4363
4371
|
key: "formatQueue",
|
|
@@ -6132,10 +6140,11 @@ var PostHog = /*#__PURE__*/function () {
|
|
|
6132
6140
|
distinct_id: uuid,
|
|
6133
6141
|
$device_id: uuid
|
|
6134
6142
|
}, '');
|
|
6135
|
-
} // Set up
|
|
6143
|
+
} // Set up event handler for pageleave
|
|
6144
|
+
// Use `onpagehide` if available, see https://calendar.perfplanet.com/2020/beaconing-in-practice/#beaconing-reliability-avoiding-abandons
|
|
6136
6145
|
|
|
6137
6146
|
|
|
6138
|
-
win.addEventListener && win.addEventListener('unload', this._handle_unload.bind(this));
|
|
6147
|
+
win.addEventListener && win.addEventListener('onpagehide' in self ? 'pagehide' : 'unload', this._handle_unload.bind(this));
|
|
6139
6148
|
} // Private methods
|
|
6140
6149
|
|
|
6141
6150
|
}, {
|