febs-browser 1.2.10 → 1.2.12

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/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * febs v1.2.10
3
- * Copyright (c) 2021 bpoint.lee@gmail.com All Rights Reserved.
2
+ * febs v1.2.12
3
+ * Copyright (c) 2026 bpoint.lee@gmail.com All Rights Reserved.
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
@@ -5539,10 +5539,40 @@
5539
5539
  //--------------------------------------------------------
5540
5540
 
5541
5541
  {
5542
+ var AbortController = function AbortController() {
5543
+ var _this = this;
5544
+
5545
+ Object.defineProperty(this, 'signal', {
5546
+ get: function get() {
5547
+ if (!_this.__signalWrap) {
5548
+ _this.__signalWrap = {};
5549
+ }
5550
+
5551
+ return _this.__signalWrap;
5552
+ },
5553
+ enumerable: true,
5554
+ configurable: true
5555
+ });
5556
+ };
5557
+
5542
5558
  if (!Promise) {
5543
5559
  throw new Error('unsupported Promise');
5544
- } // https://github.com/github/fetch
5560
+ }
5561
+
5562
+ AbortController.prototype.abort = function () {
5563
+ if (this.__signalWrap && this.__signalWrap.__xhr) {
5564
+ try {
5565
+ this.__signalWrap.__xhr.abort();
5566
+ } catch (e) {
5567
+ console.log(e);
5568
+ }
5569
+
5570
+ this.__signalWrap.__xhr = null;
5571
+ }
5572
+ };
5545
5573
 
5574
+ Window$2._AbortController = AbortController;
5575
+ net$1.AbortController = AbortController; // https://github.com/github/fetch
5546
5576
 
5547
5577
  febsnet.normalizeName = function (name) {
5548
5578
  if (typeof name !== 'string') {
@@ -5924,7 +5954,7 @@
5924
5954
  var status = xhr.status === 1223 ? 204 : xhr.status;
5925
5955
 
5926
5956
  if (status < 100 || status > 599) {
5927
- reject(new exception('Network request failed', 'NetworkFailed', __filename, __line, __column));
5957
+ reject(new exception('Network request failed', 'NetworkFailed', null, null, null));
5928
5958
  return;
5929
5959
  }
5930
5960
 
@@ -5940,21 +5970,25 @@
5940
5970
  };
5941
5971
 
5942
5972
  xhr.ontimeout = function () {
5943
- reject(new exception('Network timeout', 'NetworkTimeout', __filename, __line, __column));
5973
+ reject(new exception('Network timeout', 'NetworkTimeout', null, null, null));
5944
5974
  };
5945
5975
 
5946
5976
  xhr.onerror = function () {
5947
- reject(new exception('Network request failed', 'NetworkFailed', __filename, __line, __column));
5977
+ reject(new exception('Network request failed', 'NetworkFailed', null, null, null));
5948
5978
  };
5949
5979
 
5950
5980
  if (init && init.progress) {
5951
5981
  xhr.onprogress = function (event) {
5952
5982
  if (event.lengthComputable) {
5953
- init.progress(event.position / event.totalSize);
5983
+ init.progress((event.position || event.loaded || 0) / (event.totalSize || event.total || 1));
5954
5984
  }
5955
5985
  };
5956
5986
  }
5957
5987
 
5988
+ if (init && init.signal) {
5989
+ init.signal.__xhr = xhr;
5990
+ }
5991
+
5958
5992
  xhr.open(request.method, request.url, true);
5959
5993
  var timeout = init ? init.timeout : null;
5960
5994
  xhr.timeout = timeout !== undefined && timeout !== null ? timeout : net_transfer.DefaultTimeout;
@@ -5971,13 +6005,17 @@
5971
6005
 
5972
6006
  if (xhr.setRequestHeader) {
5973
6007
  request.headers.forEach(function (value, name) {
5974
- xhr.setRequestHeader(name, value);
6008
+ xhr.setRequestHeader(name, value.join(','));
5975
6009
  });
5976
6010
  } else if (request.headers && request.headers.map.length > 0) {
5977
6011
  console.log('fetch can\'t set headers');
5978
6012
  }
5979
6013
 
5980
- xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
6014
+ try {
6015
+ xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
6016
+ } catch (e) {
6017
+ reject(new exception('Network request failed', 'NetworkFailed', null, null, null));
6018
+ }
5981
6019
  });
5982
6020
  };
5983
6021
 
@@ -6059,6 +6097,7 @@
6059
6097
 
6060
6098
  var net$3 = {
6061
6099
  ajax: net_ajax.ajax,
6100
+ AbortController: net_fetch.AbortController,
6062
6101
  fetch: net_fetch.fetch,
6063
6102
  jsonp: net_jsonp.jsonp
6064
6103
  };