function flushTimeoutHandlers()

in src/helper/timeline.ts [109:127]


function flushTimeoutHandlers() {
    // Copy the array. In case setTimeout/clearTimeout is invoked in the callback.
    const savedTimeoutHandlers = timeoutHandlers.slice();
    for (let i = 0; i < savedTimeoutHandlers.length; i++) {
        const handler = savedTimeoutHandlers[i];
        if (handler.frame === frameIdx) {
            // Need find index again. In case setTimeout/clearTimeout is invoked in the callback.
            const idx = timeoutHandlers.indexOf(handler);
            timeoutHandlers.splice(idx, 1);
            try {
                handler.callback();
            }
            catch (e) {
                // Catch error to avoid following tasks.
                // __VRT_LOG_ERRORS__(e.toString());
            }
        }
    }
}