@ama-sdk/client-fetch 12.3.0-prerelease.70 → 12.3.0-prerelease.71
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/cjs/api-fetch-client.js +12 -13
- package/cjs/plugins/abort/abort.spec.js +79 -73
- package/cjs/plugins/concurrent/concurrent.fetch.js +8 -12
- package/cjs/plugins/concurrent/concurrent.spec.js +95 -91
- package/cjs/plugins/keepalive/keepalive.request.js +3 -4
- package/cjs/plugins/keepalive/keepalive.spec.js +28 -26
- package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +11 -14
- package/cjs/plugins/mock-intercept/mock-intercept.spec.js +243 -231
- package/cjs/plugins/perf-metric/perf-metric.fetch.js +7 -10
- package/cjs/plugins/retry/retry.fetch.js +14 -19
- package/cjs/plugins/retry/retry.spec.js +229 -217
- package/cjs/plugins/timeout/timeout.fetch.js +9 -11
- package/cjs/plugins/timeout/timeout.spec.js +207 -197
- package/cjs/plugins/wait-for/wait-for.fetch.js +15 -21
- package/cjs/plugins/wait-for/wait-for.spec.js +207 -195
- package/esm2015/api-fetch-client.js +12 -13
- package/esm2015/plugins/abort/abort.spec.js +79 -73
- package/esm2015/plugins/concurrent/concurrent.fetch.js +8 -12
- package/esm2015/plugins/concurrent/concurrent.spec.js +95 -91
- package/esm2015/plugins/keepalive/keepalive.request.js +3 -4
- package/esm2015/plugins/keepalive/keepalive.spec.js +28 -26
- package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +11 -14
- package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +243 -231
- package/esm2015/plugins/perf-metric/perf-metric.fetch.js +7 -10
- package/esm2015/plugins/retry/retry.fetch.js +14 -19
- package/esm2015/plugins/retry/retry.spec.js +229 -217
- package/esm2015/plugins/timeout/timeout.fetch.js +9 -11
- package/esm2015/plugins/timeout/timeout.spec.js +207 -197
- package/esm2015/plugins/wait-for/wait-for.fetch.js +15 -21
- package/esm2015/plugins/wait-for/wait-for.spec.js +207 -195
- package/package.json +8 -8
|
@@ -218,7 +218,6 @@ var RetryFetch = /*#__PURE__*/ function() {
|
|
|
218
218
|
{
|
|
219
219
|
key: "delay",
|
|
220
220
|
value: function delay(countDown) {
|
|
221
|
-
var _this = this;
|
|
222
221
|
return _async_to_generator(function() {
|
|
223
222
|
var time;
|
|
224
223
|
return _ts_generator(this, function(_state) {
|
|
@@ -226,7 +225,7 @@ var RetryFetch = /*#__PURE__*/ function() {
|
|
|
226
225
|
case 0:
|
|
227
226
|
return [
|
|
228
227
|
4,
|
|
229
|
-
|
|
228
|
+
this.sleepBetweenRetry(countDown)
|
|
230
229
|
];
|
|
231
230
|
case 1:
|
|
232
231
|
time = _state.sent();
|
|
@@ -238,40 +237,39 @@ var RetryFetch = /*#__PURE__*/ function() {
|
|
|
238
237
|
];
|
|
239
238
|
}
|
|
240
239
|
});
|
|
241
|
-
})();
|
|
240
|
+
}).call(this);
|
|
242
241
|
}
|
|
243
242
|
},
|
|
244
243
|
{
|
|
245
244
|
key: "waitAndRetry",
|
|
246
245
|
value: function waitAndRetry(context, countDown) {
|
|
247
|
-
var _this = this;
|
|
248
246
|
return _async_to_generator(function() {
|
|
249
247
|
return _ts_generator(this, function(_state) {
|
|
250
248
|
switch(_state.label){
|
|
251
249
|
case 0:
|
|
252
250
|
return [
|
|
253
251
|
4,
|
|
254
|
-
|
|
252
|
+
this.delay(countDown)
|
|
255
253
|
];
|
|
256
254
|
case 1:
|
|
257
255
|
_state.sent();
|
|
258
256
|
return [
|
|
259
257
|
2,
|
|
260
|
-
|
|
258
|
+
this.retry(context)
|
|
261
259
|
];
|
|
262
260
|
}
|
|
263
261
|
});
|
|
264
|
-
})();
|
|
262
|
+
}).call(this);
|
|
265
263
|
}
|
|
266
264
|
},
|
|
267
265
|
{
|
|
268
266
|
key: "load",
|
|
269
267
|
value: /** @inheritDoc */ function load(context) {
|
|
270
|
-
var countDown = this.numberOfRetry;
|
|
271
268
|
var _this = this;
|
|
269
|
+
var countDown = this.numberOfRetry;
|
|
272
270
|
return {
|
|
273
|
-
transform:
|
|
274
|
-
|
|
271
|
+
transform: function(fetchCall) {
|
|
272
|
+
return _async_to_generator(function() {
|
|
275
273
|
var result, conditionResult, e, conditionResult1;
|
|
276
274
|
return _ts_generator(this, function(_state) {
|
|
277
275
|
switch(_state.label){
|
|
@@ -294,7 +292,7 @@ var RetryFetch = /*#__PURE__*/ function() {
|
|
|
294
292
|
];
|
|
295
293
|
return [
|
|
296
294
|
4,
|
|
297
|
-
|
|
295
|
+
this.condition(context, result.clone())
|
|
298
296
|
];
|
|
299
297
|
case 2:
|
|
300
298
|
conditionResult = _state.sent();
|
|
@@ -302,7 +300,7 @@ var RetryFetch = /*#__PURE__*/ function() {
|
|
|
302
300
|
countDown--;
|
|
303
301
|
return [
|
|
304
302
|
2,
|
|
305
|
-
|
|
303
|
+
this.waitAndRetry(context, countDown)
|
|
306
304
|
];
|
|
307
305
|
}
|
|
308
306
|
_state.label = 3;
|
|
@@ -319,7 +317,7 @@ var RetryFetch = /*#__PURE__*/ function() {
|
|
|
319
317
|
];
|
|
320
318
|
return [
|
|
321
319
|
4,
|
|
322
|
-
|
|
320
|
+
this.condition(context, undefined, e)
|
|
323
321
|
];
|
|
324
322
|
case 5:
|
|
325
323
|
conditionResult1 = _state.sent();
|
|
@@ -327,7 +325,7 @@ var RetryFetch = /*#__PURE__*/ function() {
|
|
|
327
325
|
countDown--;
|
|
328
326
|
return [
|
|
329
327
|
2,
|
|
330
|
-
|
|
328
|
+
this.waitAndRetry(context, countDown)
|
|
331
329
|
];
|
|
332
330
|
}
|
|
333
331
|
_state.label = 6;
|
|
@@ -339,11 +337,8 @@ var RetryFetch = /*#__PURE__*/ function() {
|
|
|
339
337
|
];
|
|
340
338
|
}
|
|
341
339
|
});
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
return _ref.apply(this, arguments);
|
|
345
|
-
};
|
|
346
|
-
}()
|
|
340
|
+
}).call(_this);
|
|
341
|
+
}
|
|
347
342
|
};
|
|
348
343
|
}
|
|
349
344
|
}
|
|
@@ -124,221 +124,233 @@ function _ts_generator(thisArg, body) {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
describe('Retry Fetch Plugin', function() {
|
|
127
|
-
it('should not retry on success',
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
res
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
jest.
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
127
|
+
it('should not retry on success', function() {
|
|
128
|
+
return _async_to_generator(function() {
|
|
129
|
+
var condition, plugin, runner, call, res, ret;
|
|
130
|
+
return _ts_generator(this, function(_state) {
|
|
131
|
+
switch(_state.label){
|
|
132
|
+
case 0:
|
|
133
|
+
condition = jest.fn().mockReturnValue(true);
|
|
134
|
+
plugin = new _retryfetch.RetryFetch(1, condition);
|
|
135
|
+
runner = plugin.load({
|
|
136
|
+
url: 'http://www.test.com',
|
|
137
|
+
fetchPlugins: []
|
|
138
|
+
});
|
|
139
|
+
call = Promise.resolve({
|
|
140
|
+
text: 'test',
|
|
141
|
+
ok: true
|
|
142
|
+
});
|
|
143
|
+
res = runner.transform(call);
|
|
144
|
+
expect(condition).not.toHaveBeenCalled();
|
|
145
|
+
return [
|
|
146
|
+
4,
|
|
147
|
+
res
|
|
148
|
+
];
|
|
149
|
+
case 1:
|
|
150
|
+
ret = _state.sent();
|
|
151
|
+
expect(ret).toEqual({
|
|
152
|
+
text: 'test',
|
|
153
|
+
ok: true
|
|
154
|
+
});
|
|
155
|
+
return [
|
|
156
|
+
2
|
|
157
|
+
];
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
})();
|
|
161
|
+
});
|
|
162
|
+
it('should not retry if refused by the condition', function() {
|
|
163
|
+
return _async_to_generator(function() {
|
|
164
|
+
var conditionFalsy, plugin, runner, call, res;
|
|
165
|
+
return _ts_generator(this, function(_state) {
|
|
166
|
+
switch(_state.label){
|
|
167
|
+
case 0:
|
|
168
|
+
conditionFalsy = jest.fn().mockReturnValue(false);
|
|
169
|
+
plugin = new _retryfetch.RetryFetch(3, conditionFalsy);
|
|
170
|
+
runner = plugin.load({
|
|
171
|
+
url: 'http://www.test.com',
|
|
172
|
+
fetchPlugins: []
|
|
173
|
+
});
|
|
174
|
+
call = Promise.resolve({
|
|
175
|
+
text: 'test',
|
|
176
|
+
ok: false,
|
|
177
|
+
clone: function() {
|
|
178
|
+
return {};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
res = runner.transform(call);
|
|
182
|
+
return [
|
|
183
|
+
4,
|
|
184
|
+
res
|
|
185
|
+
];
|
|
186
|
+
case 1:
|
|
187
|
+
_state.sent();
|
|
188
|
+
expect(conditionFalsy).toHaveBeenCalledTimes(1);
|
|
189
|
+
return [
|
|
190
|
+
2
|
|
191
|
+
];
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
})();
|
|
195
|
+
});
|
|
196
|
+
it('should retry on fetch rejection', function() {
|
|
197
|
+
return _async_to_generator(function() {
|
|
198
|
+
var condition, plugin, runners, runner, call, callback;
|
|
199
|
+
return _ts_generator(this, function(_state) {
|
|
200
|
+
switch(_state.label){
|
|
201
|
+
case 0:
|
|
202
|
+
condition = jest.fn().mockReturnValue(true);
|
|
203
|
+
plugin = new _retryfetch.RetryFetch(2, condition);
|
|
204
|
+
runners = [];
|
|
205
|
+
runner = plugin.load({
|
|
206
|
+
url: 'not an url',
|
|
207
|
+
fetchPlugins: runners
|
|
208
|
+
});
|
|
209
|
+
runners.push(runner);
|
|
210
|
+
call = Promise.reject(new Error(JSON.stringify({
|
|
211
|
+
text: 'test',
|
|
212
|
+
ok: true
|
|
213
|
+
})));
|
|
214
|
+
callback = jest.fn();
|
|
215
|
+
runner.transform(call).catch(callback);
|
|
216
|
+
return [
|
|
217
|
+
4,
|
|
218
|
+
jest.runAllTimersAsync()
|
|
219
|
+
];
|
|
220
|
+
case 1:
|
|
221
|
+
_state.sent();
|
|
222
|
+
expect(callback).toHaveBeenCalledWith(expect.objectContaining({}));
|
|
223
|
+
expect(condition).toHaveBeenCalledTimes(2);
|
|
224
|
+
return [
|
|
225
|
+
2
|
|
226
|
+
];
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
})();
|
|
230
|
+
});
|
|
231
|
+
it('should retry on fetch rejection with wait', function() {
|
|
232
|
+
return _async_to_generator(function() {
|
|
233
|
+
var condition, delay, plugin, runners, runner, call, callback;
|
|
234
|
+
return _ts_generator(this, function(_state) {
|
|
235
|
+
switch(_state.label){
|
|
236
|
+
case 0:
|
|
237
|
+
condition = jest.fn().mockReturnValue(true);
|
|
238
|
+
delay = 500;
|
|
239
|
+
plugin = new _retryfetch.RetryFetch(2, condition, function() {
|
|
240
|
+
return delay;
|
|
241
|
+
});
|
|
242
|
+
runners = [];
|
|
243
|
+
runner = plugin.load({
|
|
244
|
+
url: 'not an url',
|
|
245
|
+
fetchPlugins: runners
|
|
246
|
+
});
|
|
247
|
+
runners.push(runner);
|
|
248
|
+
call = Promise.reject(new Error(JSON.stringify({
|
|
249
|
+
text: 'test',
|
|
250
|
+
ok: true
|
|
251
|
+
})));
|
|
252
|
+
callback = jest.fn();
|
|
253
|
+
runner.transform(call).catch(callback);
|
|
254
|
+
return [
|
|
255
|
+
4,
|
|
256
|
+
jest.advanceTimersByTimeAsync(delay)
|
|
257
|
+
];
|
|
258
|
+
case 1:
|
|
259
|
+
_state.sent();
|
|
260
|
+
expect(callback).not.toHaveBeenCalled();
|
|
261
|
+
return [
|
|
262
|
+
4,
|
|
263
|
+
jest.advanceTimersByTimeAsync(delay)
|
|
264
|
+
];
|
|
265
|
+
case 2:
|
|
266
|
+
_state.sent();
|
|
267
|
+
expect(callback).toHaveBeenCalledWith(expect.objectContaining({}));
|
|
268
|
+
expect(condition).toHaveBeenCalledTimes(2);
|
|
269
|
+
return [
|
|
270
|
+
2
|
|
271
|
+
];
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
})();
|
|
275
|
+
});
|
|
276
|
+
it('should retry on not ok call', function() {
|
|
277
|
+
return _async_to_generator(function() {
|
|
278
|
+
var condition, plugin, runners, runner, call, callback;
|
|
279
|
+
return _ts_generator(this, function(_state) {
|
|
280
|
+
switch(_state.label){
|
|
281
|
+
case 0:
|
|
282
|
+
condition = jest.fn().mockReturnValue(true);
|
|
283
|
+
plugin = new _retryfetch.RetryFetch(3, condition);
|
|
284
|
+
runners = [];
|
|
285
|
+
runner = plugin.load({
|
|
286
|
+
url: 'not an url',
|
|
287
|
+
fetchPlugins: runners
|
|
288
|
+
});
|
|
289
|
+
runners.push(runner);
|
|
290
|
+
call = Promise.resolve({
|
|
291
|
+
text: 'test',
|
|
292
|
+
ok: false
|
|
293
|
+
});
|
|
294
|
+
callback = jest.fn();
|
|
295
|
+
runner.transform(call).catch(callback);
|
|
296
|
+
return [
|
|
297
|
+
4,
|
|
298
|
+
jest.runAllTimersAsync()
|
|
299
|
+
];
|
|
300
|
+
case 1:
|
|
301
|
+
_state.sent();
|
|
302
|
+
expect(callback).toHaveBeenCalledWith(expect.objectContaining({}));
|
|
303
|
+
expect(condition).toHaveBeenCalledTimes(3);
|
|
304
|
+
return [
|
|
305
|
+
2
|
|
306
|
+
];
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
})();
|
|
310
|
+
});
|
|
311
|
+
it('should retry on not ok call with wait', function() {
|
|
312
|
+
return _async_to_generator(function() {
|
|
313
|
+
var condition, delay, plugin, runners, runner, call, callback;
|
|
314
|
+
return _ts_generator(this, function(_state) {
|
|
315
|
+
switch(_state.label){
|
|
316
|
+
case 0:
|
|
317
|
+
condition = jest.fn().mockReturnValue(true);
|
|
318
|
+
delay = 500;
|
|
319
|
+
plugin = new _retryfetch.RetryFetch(3, condition, function() {
|
|
320
|
+
return delay;
|
|
321
|
+
});
|
|
322
|
+
runners = [];
|
|
323
|
+
runner = plugin.load({
|
|
324
|
+
url: 'not an url',
|
|
325
|
+
fetchPlugins: runners
|
|
326
|
+
});
|
|
327
|
+
runners.push(runner);
|
|
328
|
+
call = Promise.resolve({
|
|
329
|
+
text: 'test',
|
|
330
|
+
ok: false
|
|
331
|
+
});
|
|
332
|
+
callback = jest.fn();
|
|
333
|
+
runner.transform(call).catch(callback);
|
|
334
|
+
return [
|
|
335
|
+
4,
|
|
336
|
+
jest.advanceTimersByTimeAsync(2 * delay)
|
|
337
|
+
];
|
|
338
|
+
case 1:
|
|
339
|
+
_state.sent();
|
|
340
|
+
expect(callback).not.toHaveBeenCalled();
|
|
341
|
+
return [
|
|
342
|
+
4,
|
|
343
|
+
jest.advanceTimersByTimeAsync(delay)
|
|
344
|
+
];
|
|
345
|
+
case 2:
|
|
346
|
+
_state.sent();
|
|
347
|
+
expect(callback).toHaveBeenCalledWith(expect.objectContaining({}));
|
|
348
|
+
expect(condition).toHaveBeenCalledTimes(3);
|
|
349
|
+
return [
|
|
350
|
+
2
|
|
351
|
+
];
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
})();
|
|
355
|
+
});
|
|
344
356
|
});
|
|
@@ -242,18 +242,19 @@ var TimeoutFetch = /*#__PURE__*/ function() {
|
|
|
242
242
|
return {
|
|
243
243
|
transform: function(fetchCall) {
|
|
244
244
|
return(// eslint-disable-next-line no-async-promise-executor -- all await are handled with a try-catch block
|
|
245
|
-
new Promise(
|
|
246
|
-
|
|
247
|
-
var timeoutCallback, timer, timerCallback, response, ex;
|
|
245
|
+
new Promise(function(resolve, reject) {
|
|
246
|
+
return _async_to_generator(function() {
|
|
247
|
+
var _this, timeoutCallback, timer, timerCallback, response, ex;
|
|
248
248
|
return _ts_generator(this, function(_state) {
|
|
249
249
|
switch(_state.label){
|
|
250
250
|
case 0:
|
|
251
|
+
_this = this;
|
|
251
252
|
timeoutCallback = function() {
|
|
252
253
|
reject(new _core.ResponseTimeoutError("in ".concat(_this.timeout, "ms")));
|
|
253
254
|
// Fetch abort controller is now supported by all modern browser and node 15+. It should always be defined
|
|
254
255
|
context.controller.abort();
|
|
255
256
|
};
|
|
256
|
-
timer =
|
|
257
|
+
timer = this.timerPauseState === 'timeoutStopped' ? undefined : setTimeout(timeoutCallback, this.timeout);
|
|
257
258
|
timerCallback = function(pauseStatus) {
|
|
258
259
|
if (timer && pauseStatus === 'timeoutStopped') {
|
|
259
260
|
clearTimeout(timer);
|
|
@@ -264,7 +265,7 @@ var TimeoutFetch = /*#__PURE__*/ function() {
|
|
|
264
265
|
(context.logger || console).log('[SDK Plugins] Timeout restarted.');
|
|
265
266
|
}
|
|
266
267
|
};
|
|
267
|
-
|
|
268
|
+
this.timerSubscription.push(timerCallback);
|
|
268
269
|
_state.label = 1;
|
|
269
270
|
case 1:
|
|
270
271
|
_state.trys.push([
|
|
@@ -297,7 +298,7 @@ var TimeoutFetch = /*#__PURE__*/ function() {
|
|
|
297
298
|
if (timer) {
|
|
298
299
|
clearTimeout(timer);
|
|
299
300
|
}
|
|
300
|
-
|
|
301
|
+
this.timerSubscription = this.timerSubscription.filter(function(callback) {
|
|
301
302
|
return timerCallback !== callback;
|
|
302
303
|
});
|
|
303
304
|
return [
|
|
@@ -309,11 +310,8 @@ var TimeoutFetch = /*#__PURE__*/ function() {
|
|
|
309
310
|
];
|
|
310
311
|
}
|
|
311
312
|
});
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
return _ref.apply(this, arguments);
|
|
315
|
-
};
|
|
316
|
-
}()));
|
|
313
|
+
}).call(_this);
|
|
314
|
+
}));
|
|
317
315
|
}
|
|
318
316
|
};
|
|
319
317
|
}
|