mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
fix: added a polyfill for requestIdleCallback to support safari browser
This commit is contained in:
parent
84f70ac208
commit
12c4a0211d
2 changed files with 21 additions and 0 deletions
|
|
@ -52,6 +52,7 @@ import { BoundedBox } from '@/Editor/Components/BoundedBox/BoundedBox';
|
|||
import { isPDFSupported } from '@/_helpers/appUtils';
|
||||
import { resolveWidgetFieldValue } from '@/_helpers/utils';
|
||||
import { useEditorStore } from '@/_stores/editorStore';
|
||||
import './requestIdleCallbackPolyfill';
|
||||
|
||||
export function memoizeFunction(func) {
|
||||
const cache = new Map();
|
||||
|
|
|
|||
20
frontend/src/_helpers/requestIdleCallbackPolyfill.js
Normal file
20
frontend/src/_helpers/requestIdleCallbackPolyfill.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Polyfill for window.requestIdleCallback to support Safari browser
|
||||
window.requestIdleCallback =
|
||||
window.requestIdleCallback ||
|
||||
function (cb) {
|
||||
var start = Date.now();
|
||||
return setTimeout(function () {
|
||||
cb({
|
||||
didTimeout: false,
|
||||
timeRemaining: function () {
|
||||
return Math.max(0, 50 - (Date.now() - start));
|
||||
},
|
||||
});
|
||||
}, 1);
|
||||
};
|
||||
|
||||
window.cancelIdleCallback =
|
||||
window.cancelIdleCallback ||
|
||||
function (id) {
|
||||
clearTimeout(id);
|
||||
};
|
||||
Loading…
Reference in a new issue