@tarojs/taro-h5 3.6.5-canary.0 → 3.6.5

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.
@@ -1,4 +1,4 @@
1
- import { __awaiter } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js';
1
+ import { __awaiter } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js';
2
2
  import { getMobileDetect } from '@tarojs/router/dist/utils/navigate';
3
3
  import { temporarilyNotSupport } from '../../utils/index.js';
4
4
  import { MethodHandler } from '../../utils/handler.js';
@@ -1,4 +1,4 @@
1
- import { __awaiter } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js';
1
+ import { __awaiter } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js';
2
2
 
3
3
  const TextBaseLineMap = {
4
4
  top: 'top',
@@ -1,4 +1,4 @@
1
- import { __awaiter } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js';
1
+ import { __awaiter } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js';
2
2
  import { permanentlyNotSupport } from '../../utils/index.js';
3
3
  import { MethodHandler } from '../../utils/handler.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { __awaiter } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js';
1
+ import { __awaiter } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js';
2
2
  import { isFunction } from '@tarojs/shared';
3
3
  import { MethodHandler } from '../../utils/handler.js';
4
4
  import { setStorage, setStorageSync, getStorageSync } from '../storage/index.js';
@@ -1,4 +1,4 @@
1
- import { __awaiter } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js';
1
+ import { __awaiter } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js';
2
2
  import { temporarilyNotSupport } from '../../utils/index.js';
3
3
  import { MethodHandler, CallbackManager } from '../../utils/handler.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { __rest } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js';
1
+ import { __rest } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js';
2
2
  import './style.scss.js';
3
3
  import { stringify } from 'query-string';
4
4
  import { MethodHandler } from '../../utils/handler.js';
@@ -1,4 +1,4 @@
1
- import { __awaiter } from '../../../node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js';
1
+ import { __awaiter } from '../../../node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js';
2
2
  import { defineCustomElementTaroSwiperCore, defineCustomElementTaroSwiperItemCore } from '@tarojs/components/dist/components';
3
3
  import { isFunction } from '@tarojs/shared';
4
4
  import { shouldBeObject } from '../../../utils/index.js';
@@ -1,4 +1,5 @@
1
1
  import 'whatwg-fetch';
2
+ import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only';
2
3
  import Taro from '@tarojs/api';
3
4
  import { isFunction } from '@tarojs/shared';
4
5
  import jsonpRetry from 'jsonp-retry';
@@ -80,12 +81,24 @@ function _request(options) {
80
81
  if (options.mode) {
81
82
  params.mode = options.mode;
82
83
  }
84
+ let timeoutTimer = null;
83
85
  if (options.signal) {
84
86
  params.signal = options.signal;
85
87
  }
88
+ else if (typeof options.timeout === 'number') {
89
+ const controller = new window.AbortController();
90
+ params.signal = controller.signal;
91
+ timeoutTimer = setTimeout(function () {
92
+ controller.abort();
93
+ }, options.timeout);
94
+ }
86
95
  params.credentials = options.credentials;
87
96
  return fetch(url, params)
88
97
  .then(response => {
98
+ if (timeoutTimer) {
99
+ clearTimeout(timeoutTimer);
100
+ timeoutTimer = null;
101
+ }
89
102
  if (!response) {
90
103
  const errorResponse = { ok: false };
91
104
  throw errorResponse;
@@ -117,6 +130,10 @@ function _request(options) {
117
130
  return res;
118
131
  })
119
132
  .catch(err => {
133
+ if (timeoutTimer) {
134
+ clearTimeout(timeoutTimer);
135
+ timeoutTimer = null;
136
+ }
120
137
  isFunction(fail) && fail(err);
121
138
  isFunction(complete) && complete(res);
122
139
  err.statusCode = res.statusCode;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/api/network/request/index.ts"],"sourcesContent":["import 'whatwg-fetch'\n\nimport Taro from '@tarojs/api'\nimport { isFunction } from '@tarojs/shared'\nimport jsonpRetry from 'jsonp-retry'\n\nimport { serializeParams } from '../../../utils'\n\n// @ts-ignore\nconst { Link } = Taro\n\nfunction generateRequestUrlWithParams (url: string, params?: unknown) {\n params = typeof params === 'string' ? params : serializeParams(params)\n if (params) {\n url += (~url.indexOf('?') ? '&' : '?') + params\n }\n url = url.replace('?&', '?')\n return url\n}\n\n// FIXME 移除 any 标注\nfunction _request (options) {\n options = options || {}\n if (typeof options === 'string') {\n options = {\n url: options\n }\n }\n const { success, complete, fail } = options\n let url = options.url\n const params: any = {}\n const res: any = {}\n if (options.jsonp) {\n Object.assign(params, options)\n params.params = options.data\n params.cache = options.jsonpCache\n if (typeof options.jsonp === 'string') {\n params.name = options.jsonp\n }\n delete params.jsonp\n return jsonpRetry(url, params)\n .then(data => {\n res.statusCode = 200\n res.data = data\n isFunction(success) && success(res)\n isFunction(complete) && complete(res)\n return res\n })\n .catch(err => {\n isFunction(fail) && fail(err)\n isFunction(complete) && complete(res)\n return Promise.reject(err)\n })\n }\n params.method = options.method || 'GET'\n const methodUpper = params.method.toUpperCase()\n params.cache = options.cache || 'default'\n if (methodUpper === 'GET' || methodUpper === 'HEAD') {\n url = generateRequestUrlWithParams(url, options.data)\n } else if (Object.prototype.toString.call(options.data) === '[object Object]') {\n options.header = options.header || {}\n\n const keyOfContentType = Object.keys(options.header).find(item => item.toLowerCase() === 'content-type')\n if (!keyOfContentType) {\n options.header['Content-Type'] = 'application/json'\n }\n const contentType = options.header[keyOfContentType || 'Content-Type']\n\n if (contentType.indexOf('application/json') >= 0) {\n params.body = JSON.stringify(options.data)\n } else if (contentType.indexOf('application/x-www-form-urlencoded') >= 0) {\n params.body = serializeParams(options.data)\n } else {\n params.body = options.data\n }\n } else {\n params.body = options.data\n }\n if (options.header) {\n params.headers = options.header\n }\n if (options.mode) {\n params.mode = options.mode\n }\n if (options.signal) {\n params.signal = options.signal\n }\n params.credentials = options.credentials\n return fetch(url, params)\n .then(response => {\n if (!response) {\n const errorResponse = { ok: false }\n throw errorResponse\n }\n res.statusCode = response.status\n res.header = {}\n for (const key of response.headers.keys()) {\n res.header[key] = response.headers.get(key)\n }\n if (options.responseType === 'arraybuffer') {\n return response.arrayBuffer()\n }\n if (res.statusCode !== 204) {\n if (options.dataType === 'json' || typeof options.dataType === 'undefined') {\n return response.json().catch(() => {\n return null\n })\n }\n }\n if (options.responseType === 'text' || options.dataType === 'text') {\n return response.text()\n }\n return Promise.resolve(null)\n })\n .then(data => {\n res.data = data\n isFunction(success) && success(res)\n isFunction(complete) && complete(res)\n return res\n })\n .catch(err => {\n isFunction(fail) && fail(err)\n isFunction(complete) && complete(res)\n err.statusCode = res.statusCode\n err.errMsg = err.message\n return Promise.reject(err)\n })\n}\n\nfunction taroInterceptor (chain) {\n return _request(chain.requestParams)\n}\n\nconst link = new Link(taroInterceptor)\n\nexport const request: typeof Taro.request = link.request.bind(link)\nexport const addInterceptor = link.addInterceptor.bind(link)\n"],"names":[],"mappings":";;;;;;AAQA;AACA,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;AAErB,SAAS,4BAA4B,CAAE,GAAW,EAAE,MAAgB,EAAA;AAClE,IAAA,MAAM,GAAG,OAAO,MAAM,KAAK,QAAQ,GAAG,MA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,GAAG,IAAG;QACX,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAA;QAC7B,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAA;AACrC,QAAA,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAA;AAC/B,QAAA,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,CAAA;AACxB,QAAA,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC5B,KAAC,CAAC,CAAA;AACN,CAAC;AAED,SAAS,eAAe,CAAE,KAAK,EAAA;AAC7B,IAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;AACtC,CAAC;AAED,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,CAAA;AAE/B,MAAM,OAAO,GAAwB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAC;AAC5D,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/api/network/request/index.ts"],"sourcesContent":["import 'whatwg-fetch'\nimport 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'\n\nimport Taro from '@tarojs/api'\nimport { isFunction } from '@tarojs/shared'\nimport jsonpRetry from 'jsonp-retry'\n\nimport { serializeParams } from '../../../utils'\n\n// @ts-ignore\nconst { Link } = Taro\n\nfunction generateRequestUrlWithParams (url: string, params?: unknown) {\n params = typeof params === 'string' ? params : serializeParams(params)\n if (params) {\n url += (~url.indexOf('?') ? '&' : '?') + params\n }\n url = url.replace('?&', '?')\n return url\n}\n\n// FIXME 移除 any 标注\nfunction _request (options) {\n options = options || {}\n if (typeof options === 'string') {\n options = {\n url: options\n }\n }\n const { success, complete, fail } = options\n let url = options.url\n const params: any = {}\n const res: any = {}\n if (options.jsonp) {\n Object.assign(params, options)\n params.params = options.data\n params.cache = options.jsonpCache\n if (typeof options.jsonp === 'string') {\n params.name = options.jsonp\n }\n delete params.jsonp\n return jsonpRetry(url, params)\n .then(data => {\n res.statusCode = 200\n res.data = data\n isFunction(success) && success(res)\n isFunction(complete) && complete(res)\n return res\n })\n .catch(err => {\n isFunction(fail) && fail(err)\n isFunction(complete) && complete(res)\n return Promise.reject(err)\n })\n }\n params.method = options.method || 'GET'\n const methodUpper = params.method.toUpperCase()\n params.cache = options.cache || 'default'\n if (methodUpper === 'GET' || methodUpper === 'HEAD') {\n url = generateRequestUrlWithParams(url, options.data)\n } else if (Object.prototype.toString.call(options.data) === '[object Object]') {\n options.header = options.header || {}\n\n const keyOfContentType = Object.keys(options.header).find(item => item.toLowerCase() === 'content-type')\n if (!keyOfContentType) {\n options.header['Content-Type'] = 'application/json'\n }\n const contentType = options.header[keyOfContentType || 'Content-Type']\n\n if (contentType.indexOf('application/json') >= 0) {\n params.body = JSON.stringify(options.data)\n } else if (contentType.indexOf('application/x-www-form-urlencoded') >= 0) {\n params.body = serializeParams(options.data)\n } else {\n params.body = options.data\n }\n } else {\n params.body = options.data\n }\n if (options.header) {\n params.headers = options.header\n }\n if (options.mode) {\n params.mode = options.mode\n }\n let timeoutTimer: ReturnType<typeof setTimeout> | null = null\n if (options.signal) {\n params.signal = options.signal\n } else if (typeof options.timeout === 'number') {\n const controller = new window.AbortController()\n params.signal = controller.signal\n timeoutTimer = setTimeout(function () {\n controller.abort()\n }, options.timeout)\n }\n params.credentials = options.credentials\n return fetch(url, params)\n .then(response => {\n if (timeoutTimer) {\n clearTimeout(timeoutTimer)\n timeoutTimer = null\n }\n if (!response) {\n const errorResponse = { ok: false }\n throw errorResponse\n }\n res.statusCode = response.status\n res.header = {}\n for (const key of response.headers.keys()) {\n res.header[key] = response.headers.get(key)\n }\n if (options.responseType === 'arraybuffer') {\n return response.arrayBuffer()\n }\n if (res.statusCode !== 204) {\n if (options.dataType === 'json' || typeof options.dataType === 'undefined') {\n return response.json().catch(() => {\n return null\n })\n }\n }\n if (options.responseType === 'text' || options.dataType === 'text') {\n return response.text()\n }\n return Promise.resolve(null)\n })\n .then(data => {\n res.data = data\n isFunction(success) && success(res)\n isFunction(complete) && complete(res)\n return res\n })\n .catch(err => {\n if (timeoutTimer) {\n clearTimeout(timeoutTimer)\n timeoutTimer = null\n }\n isFunction(fail) && fail(err)\n isFunction(complete) && complete(res)\n err.statusCode = res.statusCode\n err.errMsg = err.message\n return Promise.reject(err)\n })\n}\n\nfunction taroInterceptor (chain) {\n return _request(chain.requestParams)\n}\n\nconst link = new Link(taroInterceptor)\n\nexport const request: typeof Taro.request = link.request.bind(link)\nexport const addInterceptor = link.addInterceptor.bind(link)\n"],"names":[],"mappings":";;;;;;;AASA;AACA,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;AAErB,SAAS,4BAA4B,CAAE,GAAW,EAAE,MAAgB,EAAA;AAClE,IAAA,MAAM,GAAG,OAAO,MAAM,KAAK,QAAQ,GAAG,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;AACtE,IAAA,IAAI,MAAM,EAAE;QACV,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,MAAM,CAAA;AAChD,KAAA;IACD,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AAC5B,IAAA,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;AACA,SAAS,QAAQ,CAAE,OAAO,EAAA;AACxB,IAAA,OAAO,GAAG,OAAO,IAAI,EAAE,CAAA;AACvB,IAAA,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;AAC/B,QAAA,OAAO,GAAG;AACR,YAAA,GAAG,EAAE,OAAO;SACb,CAAA;AACF,KAAA;IACD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;AAC3C,IAAA,IAAI,GAAG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CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAA;QAC7B,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAA;AACrC,QAAA,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAA;AAC/B,QAAA,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,CAAA;AACxB,QAAA,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC5B,KAAC,CAAC,CAAA;AACN,CAAC;AAED,SAAS,eAAe,CAAE,KAAK,EAAA;AAC7B,IAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;AACtC,CAAC;AAED,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,CAAA;AAE/B,MAAM,OAAO,GAAwB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAC;AAC5D,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI;;;;"}
@@ -1,4 +1,4 @@
1
- import { __awaiter } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js';
1
+ import { __awaiter } from '../../node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js';
2
2
  import { MethodHandler } from '../../utils/handler.js';
3
3
 
4
4
  // 字体
@@ -1,4 +1,4 @@
1
- import { __awaiter } from '../../../node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js';
1
+ import { __awaiter } from '../../../node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js';
2
2
  import Taro from '@tarojs/api';
3
3
  import { Current } from '@tarojs/runtime';
4
4
  import { getParameterError, temporarilyNotSupport } from '../../../utils/index.js';
package/dist/index.cjs.js CHANGED
@@ -12,6 +12,7 @@ var navigate = require('@tarojs/router/dist/utils/navigate');
12
12
  var queryString = require('query-string');
13
13
  var components = require('@tarojs/components/dist/components');
14
14
  require('whatwg-fetch');
15
+ require('abortcontroller-polyfill/dist/abortcontroller-polyfill-only');
15
16
  var jsonpRetry = require('jsonp-retry');
16
17
 
17
18
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -380,7 +381,7 @@ const getLogManager = temporarilyNotSupport('getLogManager');
380
381
  const reportPerformance = temporarilyNotSupport('reportPerformance');
381
382
  const getPerformance = temporarilyNotSupport('getPerformance');
382
383
 
383
- /*! *****************************************************************************
384
+ /******************************************************************************
384
385
  Copyright (c) Microsoft Corporation.
385
386
 
386
387
  Permission to use, copy, modify, and/or distribute this software for any
@@ -399,11 +400,13 @@ PERFORMANCE OF THIS SOFTWARE.
399
400
  var extendStatics = function(d, b) {
400
401
  extendStatics = Object.setPrototypeOf ||
401
402
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
402
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
403
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
403
404
  return extendStatics(d, b);
404
405
  };
405
406
 
406
407
  function __extends(d, b) {
408
+ if (typeof b !== "function" && b !== null)
409
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
407
410
  extendStatics(d, b);
408
411
  function __() { this.constructor = d; }
409
412
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -443,6 +446,51 @@ function __param(paramIndex, decorator) {
443
446
  return function (target, key) { decorator(target, key, paramIndex); }
444
447
  }
445
448
 
449
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
450
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
451
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
452
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
453
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
454
+ var _, done = false;
455
+ for (var i = decorators.length - 1; i >= 0; i--) {
456
+ var context = {};
457
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
458
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
459
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
460
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
461
+ if (kind === "accessor") {
462
+ if (result === void 0) continue;
463
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
464
+ if (_ = accept(result.get)) descriptor.get = _;
465
+ if (_ = accept(result.set)) descriptor.set = _;
466
+ if (_ = accept(result.init)) initializers.push(_);
467
+ }
468
+ else if (_ = accept(result)) {
469
+ if (kind === "field") initializers.push(_);
470
+ else descriptor[key] = _;
471
+ }
472
+ }
473
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
474
+ done = true;
475
+ };
476
+
477
+ function __runInitializers(thisArg, initializers, value) {
478
+ var useValue = arguments.length > 2;
479
+ for (var i = 0; i < initializers.length; i++) {
480
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
481
+ }
482
+ return useValue ? value : void 0;
483
+ };
484
+
485
+ function __propKey(x) {
486
+ return typeof x === "symbol" ? x : "".concat(x);
487
+ };
488
+
489
+ function __setFunctionName(f, name, prefix) {
490
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
491
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
492
+ };
493
+
446
494
  function __metadata(metadataKey, metadataValue) {
447
495
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
448
496
  }
@@ -463,7 +511,7 @@ function __generator(thisArg, body) {
463
511
  function verb(n) { return function (v) { return step([n, v]); }; }
464
512
  function step(op) {
465
513
  if (f) throw new TypeError("Generator is already executing.");
466
- while (_) try {
514
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
467
515
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
468
516
  if (y = 0, t) op = [op[0] & 2, t.value];
469
517
  switch (op[0]) {
@@ -485,13 +533,20 @@ function __generator(thisArg, body) {
485
533
  }
486
534
  }
487
535
 
488
- function __createBinding(o, m, k, k2) {
536
+ var __createBinding = Object.create ? (function(o, m, k, k2) {
537
+ if (k2 === undefined) k2 = k;
538
+ var desc = Object.getOwnPropertyDescriptor(m, k);
539
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
540
+ desc = { enumerable: true, get: function() { return m[k]; } };
541
+ }
542
+ Object.defineProperty(o, k2, desc);
543
+ }) : (function(o, m, k, k2) {
489
544
  if (k2 === undefined) k2 = k;
490
545
  o[k2] = m[k];
491
- }
546
+ });
492
547
 
493
- function __exportStar(m, exports) {
494
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
548
+ function __exportStar(m, o) {
549
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
495
550
  }
496
551
 
497
552
  function __values(o) {
@@ -523,19 +578,31 @@ function __read(o, n) {
523
578
  return ar;
524
579
  }
525
580
 
581
+ /** @deprecated */
526
582
  function __spread() {
527
583
  for (var ar = [], i = 0; i < arguments.length; i++)
528
584
  ar = ar.concat(__read(arguments[i]));
529
585
  return ar;
530
586
  }
531
587
 
588
+ /** @deprecated */
532
589
  function __spreadArrays() {
533
590
  for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
534
591
  for (var r = Array(s), k = 0, i = 0; i < il; i++)
535
592
  for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
536
593
  r[k] = a[j];
537
594
  return r;
538
- };
595
+ }
596
+
597
+ function __spreadArray(to, from, pack) {
598
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
599
+ if (ar || !(i in from)) {
600
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
601
+ ar[i] = from[i];
602
+ }
603
+ }
604
+ return to.concat(ar || Array.prototype.slice.call(from));
605
+ }
539
606
 
540
607
  function __await(v) {
541
608
  return this instanceof __await ? (this.v = v, this) : new __await(v);
@@ -556,7 +623,7 @@ function __asyncGenerator(thisArg, _arguments, generator) {
556
623
  function __asyncDelegator(o) {
557
624
  var i, p;
558
625
  return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
559
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
626
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
560
627
  }
561
628
 
562
629
  function __asyncValues(o) {
@@ -572,11 +639,17 @@ function __makeTemplateObject(cooked, raw) {
572
639
  return cooked;
573
640
  };
574
641
 
642
+ var __setModuleDefault = Object.create ? (function(o, v) {
643
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
644
+ }) : function(o, v) {
645
+ o["default"] = v;
646
+ };
647
+
575
648
  function __importStar(mod) {
576
649
  if (mod && mod.__esModule) return mod;
577
650
  var result = {};
578
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
579
- result.default = mod;
651
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
652
+ __setModuleDefault(result, mod);
580
653
  return result;
581
654
  }
582
655
 
@@ -584,19 +657,22 @@ function __importDefault(mod) {
584
657
  return (mod && mod.__esModule) ? mod : { default: mod };
585
658
  }
586
659
 
587
- function __classPrivateFieldGet(receiver, privateMap) {
588
- if (!privateMap.has(receiver)) {
589
- throw new TypeError("attempted to get private field on non-instance");
590
- }
591
- return privateMap.get(receiver);
660
+ function __classPrivateFieldGet(receiver, state, kind, f) {
661
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
662
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
663
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
592
664
  }
593
665
 
594
- function __classPrivateFieldSet(receiver, privateMap, value) {
595
- if (!privateMap.has(receiver)) {
596
- throw new TypeError("attempted to set private field on non-instance");
597
- }
598
- privateMap.set(receiver, value);
599
- return value;
666
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
667
+ if (kind === "m") throw new TypeError("Private method is not writable");
668
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
669
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
670
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
671
+ }
672
+
673
+ function __classPrivateFieldIn(state, receiver) {
674
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
675
+ return typeof state === "function" ? receiver === state : state.has(receiver);
600
676
  }
601
677
 
602
678
  /** 跳转系统蓝牙设置页 */
@@ -2935,12 +3011,24 @@ function _request(options) {
2935
3011
  if (options.mode) {
2936
3012
  params.mode = options.mode;
2937
3013
  }
3014
+ let timeoutTimer = null;
2938
3015
  if (options.signal) {
2939
3016
  params.signal = options.signal;
2940
3017
  }
3018
+ else if (typeof options.timeout === 'number') {
3019
+ const controller = new window.AbortController();
3020
+ params.signal = controller.signal;
3021
+ timeoutTimer = setTimeout(function () {
3022
+ controller.abort();
3023
+ }, options.timeout);
3024
+ }
2941
3025
  params.credentials = options.credentials;
2942
3026
  return fetch(url, params)
2943
3027
  .then(response => {
3028
+ if (timeoutTimer) {
3029
+ clearTimeout(timeoutTimer);
3030
+ timeoutTimer = null;
3031
+ }
2944
3032
  if (!response) {
2945
3033
  const errorResponse = { ok: false };
2946
3034
  throw errorResponse;
@@ -2972,6 +3060,10 @@ function _request(options) {
2972
3060
  return res;
2973
3061
  })
2974
3062
  .catch(err => {
3063
+ if (timeoutTimer) {
3064
+ clearTimeout(timeoutTimer);
3065
+ timeoutTimer = null;
3066
+ }
2975
3067
  shared.isFunction(fail) && fail(err);
2976
3068
  shared.isFunction(complete) && complete(res);
2977
3069
  err.statusCode = res.statusCode;