File tree Expand file tree Collapse file tree 8 files changed +44
-3
lines changed Expand file tree Collapse file tree 8 files changed +44
-3
lines changed Original file line number Diff line number Diff line change 1010
1111
1212
13+ # 5.6.0
14+ > 2022.10.20
15+ 1. <font color=green> 新增</font > ` sendRequest ` 添加传递参数 ` _retryTimes ` 第几次重试
16+
17+
1318# 5.5.0
1419> 2022.08.23
15- <font color=green> 新增</font > 请求支持设置 ` timeout ` 最大请求时间(毫秒),若超出该时间,请求会自动终止
20+ 1. <font color=green> 新增</font > 请求支持设置 ` timeout ` 最大请求时间(毫秒),若超出该时间,请求会自动终止
1621
1722
1823# 5.4.1
Original file line number Diff line number Diff line change @@ -86,6 +86,10 @@ declare class AjaxBase {
8686 cancelExecutor : Ajax . ICancelExecutor ;
8787 /** 请求session过期回调 */
8888 onSessionExpired ?: Ajax . IOnSessionExpired ;
89+ /**
90+ * @private 第几次重试(内部变量)
91+ */
92+ _retryTimes ?: number ;
8993 } ) : Promise < any > ;
9094 /**
9195 * 发送请求
Original file line number Diff line number Diff line change @@ -294,6 +294,7 @@ var AjaxBase = /** @class */ (function () {
294294 ) {
295295 var _this = this ;
296296 var method ;
297+ var _retryTimes = 0 ;
297298 if ( typeof props === 'object' ) {
298299 method = props . method ;
299300 url = props . url ;
@@ -306,6 +307,9 @@ var AjaxBase = /** @class */ (function () {
306307 if ( props . onSessionExpired ) {
307308 onSessionExpired = props . onSessionExpired ;
308309 }
310+ if ( typeof props . _retryTimes === 'number' ) {
311+ _retryTimes = props . _retryTimes ;
312+ }
309313 }
310314 else {
311315 method = props ;
@@ -327,6 +331,10 @@ var AjaxBase = /** @class */ (function () {
327331 xCorrelationID : '' ,
328332 // 请求开始时间
329333 startTime : new Date ( ) . getTime ( ) ,
334+ /**
335+ * @private 第几次重试(内部变量)
336+ */
337+ _retryTimes : _retryTimes ,
330338 } ;
331339 if ( ! options ) {
332340 options = { } ;
Original file line number Diff line number Diff line change @@ -124,6 +124,10 @@ export interface IRequestOptions {
124124 xCorrelationID ?: string ;
125125 /** 请求开始时间 */
126126 startTime ?: number ;
127+ /**
128+ * @private 第几次重试(内部变量)
129+ */
130+ _retryTimes ?: number ;
127131}
128132export interface IOnSuccess < T = any > {
129133 ( xhr : XMLHttpRequest | undefined , props : {
Original file line number Diff line number Diff line change @@ -314,6 +314,10 @@ class AjaxBase {
314314 cancelExecutor : Ajax . ICancelExecutor ;
315315 /** 请求session过期回调 */
316316 onSessionExpired ?: Ajax . IOnSessionExpired ;
317+ /**
318+ * @private 第几次重试(内部变量)
319+ */
320+ _retryTimes ?: number ;
317321 // eslint-disable-next-line @typescript-eslint/no-explicit-any
318322 } ) : Promise < any > ;
319323
@@ -365,6 +369,10 @@ class AjaxBase {
365369 cancelExecutor : Ajax . ICancelExecutor ;
366370 /** 请求session过期回调 */
367371 onSessionExpired ?: Ajax . IOnSessionExpired ;
372+ /**
373+ * @private 第几次重试(内部变量)
374+ */
375+ _retryTimes ?: number ;
368376 } ,
369377 /* eslint-enable @typescript-eslint/indent */
370378 url ?: string ,
@@ -378,6 +386,7 @@ class AjaxBase {
378386 // eslint-disable-next-line @typescript-eslint/no-explicit-any
379387 ) : Promise < any > {
380388 let method : Ajax . IMethod ;
389+ let _retryTimes = 0 ;
381390 if ( typeof props === 'object' ) {
382391 method = props . method ;
383392 url = props . url ;
@@ -390,6 +399,9 @@ class AjaxBase {
390399 if ( props . onSessionExpired ) {
391400 onSessionExpired = props . onSessionExpired ;
392401 }
402+ if ( typeof props . _retryTimes === 'number' ) {
403+ _retryTimes = props . _retryTimes ;
404+ }
393405 } else {
394406 method = props ;
395407 }
@@ -410,6 +422,10 @@ class AjaxBase {
410422 xCorrelationID : '' ,
411423 // 请求开始时间
412424 startTime : new Date ( ) . getTime ( ) ,
425+ /**
426+ * @private 第几次重试(内部变量)
427+ */
428+ _retryTimes,
413429 } ;
414430 if ( ! options ) {
415431 options = { } ;
Original file line number Diff line number Diff line change @@ -176,6 +176,10 @@ export interface IRequestOptions {
176176 xCorrelationID ?: string ;
177177 /** 请求开始时间 */
178178 startTime ?: number ;
179+ /**
180+ * @private 第几次重试(内部变量)
181+ */
182+ _retryTimes ?: number ;
179183}
180184
181185// eslint-disable-next-line @typescript-eslint/no-explicit-any
Original file line number Diff line number Diff line change 11{
22 "name" : " http-ajax" ,
3- "version" : " 5.5 .0" ,
3+ "version" : " 5.6 .0" ,
44 "description" : " Promise based HTTP client for the browser" ,
55 "keywords" : [
66 " ajax" ,
You can’t perform that action at this time.
0 commit comments