Timer class (wrapper for setTimeout and setInterval). Based on AS3 Timer class