Created
July 23, 2013 21:14
-
-
Save cmertayak/6066234 to your computer and use it in GitHub Desktop.
Javascript update based on a timer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // schedule update in one second | |
| function updateLater() { | |
| // save the timeoutId for canceling | |
| timeoutId = $timeout(function() { | |
| updateTime(); // update DOM | |
| updateLater(); // schedule another update | |
| }, 1000); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment