scrivito
Version:
Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.
28 lines (20 loc) • 548 B
text/typescript
// @rewire
import { setTimeout } from 'scrivito_sdk/common';
type DelayedFunction = () => void;
let nextTickScheduler = setTimeoutScheduler;
export function nextTick(delayedFunction: DelayedFunction): void {
nextTickScheduler(delayedFunction);
}
function setTimeoutScheduler(fn: DelayedFunction) {
setTimeout(fn, 0);
}
export function throwNextTick(error: unknown) {
nextTick(() => {
throw error;
});
}
export function setNextTickScheduler(
scheduler: (fn: DelayedFunction) => void
): void {
nextTickScheduler = scheduler;
}