@honeybadger-io/js 6.10.1 → 6.11.0

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.
@@ -1018,16 +1018,17 @@
1018
1018
  this.processQueue();
1019
1019
  }
1020
1020
  };
1021
+ ThrottledEventsLogger.prototype.flushAsync = function () {
1022
+ this.logger.debug('[Honeybadger] Flushing events');
1023
+ return this.send();
1024
+ };
1021
1025
  ThrottledEventsLogger.prototype.processQueue = function () {
1022
1026
  var _this = this;
1023
1027
  if (this.queue.length === 0 || this.isProcessing) {
1024
1028
  return;
1025
1029
  }
1026
1030
  this.isProcessing = true;
1027
- var eventsData = this.queue.slice();
1028
- this.queue = [];
1029
- var data = json_nd_1.NdJson.stringify(eventsData);
1030
- this.makeHttpRequest(data)
1031
+ this.send()
1031
1032
  .then(function () {
1032
1033
  setTimeout(function () {
1033
1034
  _this.isProcessing = false;
@@ -1043,6 +1044,20 @@
1043
1044
  }, 50);
1044
1045
  });
1045
1046
  };
1047
+ ThrottledEventsLogger.prototype.send = function () {
1048
+ return __awaiter$2(this, void 0, void 0, function () {
1049
+ var eventsData, data;
1050
+ return __generator$2(this, function (_a) {
1051
+ if (this.queue.length === 0) {
1052
+ return [2 /*return*/];
1053
+ }
1054
+ eventsData = this.queue.slice();
1055
+ this.queue = [];
1056
+ data = json_nd_1.NdJson.stringify(eventsData);
1057
+ return [2 /*return*/, this.makeHttpRequest(data)];
1058
+ });
1059
+ });
1060
+ };
1046
1061
  ThrottledEventsLogger.prototype.makeHttpRequest = function (data) {
1047
1062
  return __awaiter$2(this, void 0, void 0, function () {
1048
1063
  var _this = this;
@@ -1162,7 +1177,7 @@
1162
1177
  this.__notifier = {
1163
1178
  name: '@honeybadger-io/core',
1164
1179
  url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/core',
1165
- version: '6.10.1'
1180
+ version: '6.11.0'
1166
1181
  };
1167
1182
  this.config = __assign$1(__assign$1({}, defaults_1.CONFIG), opts);
1168
1183
  this.__initStore();
@@ -1381,6 +1396,13 @@
1381
1396
  }
1382
1397
  this.__eventsLogger.log(__assign$1({ event_type: type, ts: new Date().toISOString() }, data));
1383
1398
  };
1399
+ /**
1400
+ * This method currently flushes the event (Insights) queue.
1401
+ * In the future, it should also flush the error queue (assuming an error throttler is implemented).
1402
+ */
1403
+ Client.prototype.flushAsync = function () {
1404
+ return this.__eventsLogger.flushAsync();
1405
+ };
1384
1406
  Client.prototype.__getBreadcrumbs = function () {
1385
1407
  return this.__store.getContents('breadcrumbs').slice();
1386
1408
  };
@@ -2676,7 +2698,7 @@
2676
2698
  var NOTIFIER = {
2677
2699
  name: '@honeybadger-io/js',
2678
2700
  url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',
2679
- version: '6.10.1'
2701
+ version: '6.11.0'
2680
2702
  };
2681
2703
  var userAgent = function () {
2682
2704
  if (typeof navigator !== 'undefined') {