Base setTimeout on function of interval time