added support for setTimeout and setInterval