mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
add time limit to frontend update
This commit is contained in:
@@ -316,6 +316,24 @@ function dynamicRequire(moduleName) {
|
||||
}
|
||||
}
|
||||
|
||||
function timeLimit(cb, limitMs) {
|
||||
return new Promise((res, rej) => {
|
||||
let resolved = false;
|
||||
|
||||
cb().then(() => {
|
||||
resolved = true;
|
||||
|
||||
res();
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
if (!resolved) {
|
||||
rej('Process exceeded time limit ' + limitMs);
|
||||
}
|
||||
}, limitMs);
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
reloadApp,
|
||||
parseDate,
|
||||
@@ -355,5 +373,6 @@ export default {
|
||||
normalizeShortcut,
|
||||
copySelectionToClipboard,
|
||||
isCKEditorInitialized,
|
||||
dynamicRequire
|
||||
};
|
||||
dynamicRequire,
|
||||
timeLimit
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user