replaced window.setTimeout