small patch to make the code run in nodejs

Minor tweak to check if window is defined so the animation-timer code can run server side
Merge pull request #1 from enix/patch-1

small patch to make the code run in nodejs