Fasterdom: Add suppressStrict

This commit is contained in:
Alexander Zinchuk 2025-06-04 20:40:28 +02:00
parent 3d4f98e9b3
commit 7b1b669610
2 changed files with 12 additions and 1 deletions

View File

@ -14,7 +14,7 @@ const runUpdatePassOnRaf = throttleWithRafFallback(() => {
});
// We use promises to provide correct order for Mutation Observer callback microtasks
Promise.resolve()
void Promise.resolve()
.then(() => {
setPhase('mutate');

View File

@ -73,6 +73,17 @@ export function forceMutation(cb: () => any, nodes: Node | Node[]) {
return cb();
}
export function suppressStrict(cb: () => any) {
if (!isStrict) {
return cb();
}
disableStrict();
const result = cb();
enableStrict();
return result;
}
export function setHandler(handler?: ErrorHandler) {
onError = handler || DEFAULT_ERROR_HANDLER;
}