mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 21:17:18 -04:00
Try to fix afterwards loading of cards by adding
fallback when requestIdleCallback is not available. Thanks to xet7 ! Closes #2878, closes #2250
This commit is contained in:
parent
906c25d5e8
commit
2b9540ce02
1 changed files with 17 additions and 1 deletions
|
@ -743,9 +743,25 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
|
||||
updateList() {
|
||||
// Use fallback when requestIdleCallback is not available on iOS and Safari
|
||||
// https://www.afasterweb.com/2017/11/20/utilizing-idle-moments/
|
||||
checkIdleTime =
|
||||
window.requestIdleCallback ||
|
||||
function(handler) {
|
||||
const startTime = Date.now();
|
||||
return setTimeout(function() {
|
||||
handler({
|
||||
didTimeout: false,
|
||||
timeRemaining() {
|
||||
return Math.max(0, 50.0 - (Date.now() - startTime));
|
||||
},
|
||||
});
|
||||
}, 1);
|
||||
};
|
||||
|
||||
if (this.spinnerInView()) {
|
||||
this.cardlimit.set(this.cardlimit.get() + InfiniteScrollIter);
|
||||
window.requestIdleCallback(() => this.updateList());
|
||||
checkIdleTime(() => this.updateList());
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue