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.esm.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
 
@@ -5533,10 +5533,40 @@ var net$1 = {}; //--------------------------------------------------------
5533
5533
  //--------------------------------------------------------
5534
5534
 
5535
5535
  {
5536
+ var AbortController = function AbortController() {
5537
+ var _this = this;
5538
+
5539
+ Object.defineProperty(this, 'signal', {
5540
+ get: function get() {
5541
+ if (!_this.__signalWrap) {
5542
+ _this.__signalWrap = {};
5543
+ }
5544
+
5545
+ return _this.__signalWrap;
5546
+ },
5547
+ enumerable: true,
5548
+ configurable: true
5549
+ });
5550
+ };
5551
+
5536
5552
  if (!Promise) {
5537
5553
  throw new Error('unsupported Promise');
5538
- } // https://github.com/github/fetch
5554
+ }
5555
+
5556
+ AbortController.prototype.abort = function () {
5557
+ if (this.__signalWrap && this.__signalWrap.__xhr) {
5558
+ try {
5559
+ this.__signalWrap.__xhr.abort();
5560
+ } catch (e) {
5561
+ console.log(e);
5562
+ }
5563
+
5564
+ this.__signalWrap.__xhr = null;
5565
+ }
5566
+ };
5539
5567
 
5568
+ Window$2._AbortController = AbortController;
5569
+ net$1.AbortController = AbortController; // https://github.com/github/fetch
5540
5570
 
5541
5571
  febsnet.normalizeName = function (name) {
5542
5572
  if (typeof name !== 'string') {
@@ -5918,7 +5948,7 @@ var net$1 = {}; //--------------------------------------------------------
5918
5948
  var status = xhr.status === 1223 ? 204 : xhr.status;
5919
5949
 
5920
5950
  if (status < 100 || status > 599) {
5921
- reject(new exception('Network request failed', 'NetworkFailed', __filename, __line, __column));
5951
+ reject(new exception('Network request failed', 'NetworkFailed', null, null, null));
5922
5952
  return;
5923
5953
  }
5924
5954
 
@@ -5934,21 +5964,25 @@ var net$1 = {}; //--------------------------------------------------------
5934
5964
  };
5935
5965
 
5936
5966
  xhr.ontimeout = function () {
5937
- reject(new exception('Network timeout', 'NetworkTimeout', __filename, __line, __column));
5967
+ reject(new exception('Network timeout', 'NetworkTimeout', null, null, null));
5938
5968
  };
5939
5969
 
5940
5970
  xhr.onerror = function () {
5941
- reject(new exception('Network request failed', 'NetworkFailed', __filename, __line, __column));
5971
+ reject(new exception('Network request failed', 'NetworkFailed', null, null, null));
5942
5972
  };
5943
5973
 
5944
5974
  if (init && init.progress) {
5945
5975
  xhr.onprogress = function (event) {
5946
5976
  if (event.lengthComputable) {
5947
- init.progress(event.position / event.totalSize);
5977
+ init.progress((event.position || event.loaded || 0) / (event.totalSize || event.total || 1));
5948
5978
  }
5949
5979
  };
5950
5980
  }
5951
5981
 
5982
+ if (init && init.signal) {
5983
+ init.signal.__xhr = xhr;
5984
+ }
5985
+
5952
5986
  xhr.open(request.method, request.url, true);
5953
5987
  var timeout = init ? init.timeout : null;
5954
5988
  xhr.timeout = timeout !== undefined && timeout !== null ? timeout : net_transfer.DefaultTimeout;
@@ -5965,13 +5999,17 @@ var net$1 = {}; //--------------------------------------------------------
5965
5999
 
5966
6000
  if (xhr.setRequestHeader) {
5967
6001
  request.headers.forEach(function (value, name) {
5968
- xhr.setRequestHeader(name, value);
6002
+ xhr.setRequestHeader(name, value.join(','));
5969
6003
  });
5970
6004
  } else if (request.headers && request.headers.map.length > 0) {
5971
6005
  console.log('fetch can\'t set headers');
5972
6006
  }
5973
6007
 
5974
- xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
6008
+ try {
6009
+ xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
6010
+ } catch (e) {
6011
+ reject(new exception('Network request failed', 'NetworkFailed', null, null, null));
6012
+ }
5975
6013
  });
5976
6014
  };
5977
6015
 
@@ -6053,6 +6091,7 @@ var net_jsonp = net$2;
6053
6091
 
6054
6092
  var net$3 = {
6055
6093
  ajax: net_ajax.ajax,
6094
+ AbortController: net_fetch.AbortController,
6056
6095
  fetch: net_fetch.fetch,
6057
6096
  jsonp: net_jsonp.jsonp
6058
6097
  };