Javascript like methods for SetTimeout and SetInterval