What they said
Plus, its also probably noteworthy to make sure you use setTimer (0.05 or however long...) in the onTimeout function to continue the loop -- you don't have it this way in your example.
Also, not necessary, but if you wanted to start the loop as immediately as it was created just call onTimeout (); in the on created function.
edit: sorry, missed it on my phone.
callimuc's example is spot on -- disregard my post if you follow his examples -- or just take them as an explanation for what he did. :]