|
|
@@ -238,14 +238,14 @@ export const BaseService = serviceFactory({
|
|
|
},
|
|
|
loadData(options) {
|
|
|
const { progress } = this;
|
|
|
- let lastFetch;
|
|
|
- if (options.delay == null) {
|
|
|
- lastFetch = Promise.resolve(Date.now());
|
|
|
- } else {
|
|
|
+ let { delay } = options;
|
|
|
+ if (delay == null) {
|
|
|
+ delay = this.delayTime;
|
|
|
+ }
|
|
|
+ let lastFetch = Promise.resolve();
|
|
|
+ if (delay) {
|
|
|
lastFetch = this.lastFetch
|
|
|
.then(ts => new Promise(resolve => {
|
|
|
- let delay = options.delay;
|
|
|
- if (!isNaN(delay)) delay = this.delayTime;
|
|
|
const delta = delay - (Date.now() - ts);
|
|
|
if (delta > 0) {
|
|
|
setTimeout(resolve, delta);
|
|
|
@@ -254,8 +254,8 @@ export const BaseService = serviceFactory({
|
|
|
}
|
|
|
}))
|
|
|
.then(() => Date.now());
|
|
|
+ this.lastFetch = lastFetch;
|
|
|
}
|
|
|
- this.lastFetch = lastFetch;
|
|
|
progress.total += 1;
|
|
|
onStateChange();
|
|
|
return lastFetch.then(() => {
|