Live data from Hacker News

Start a timer via the url

alrt.io

31–39 of 39 posts

Re: Start a timer via the url

#33
Cool to see others doing this too!

We've (Sleep.fm) allowed users to set our online alarm clock by typing or clicking a URL(sets time & sound).

Examples...

http://sleep.fm/7am (sets alarm for 7am)

http://sleep.fm/10pmRooster (sets alarm for 10pm; sound is Rooster)

http://sleep.fm/6amWeather (sets alarm for 6am; sound is spoken weather report)

Re: Start a timer via the url

#35
post #22

The timeLeft -= 1000 approach is not the best one because setTimeout doesn't guarantee when the next tick is gonna happen. Just open the JS console and type: for (var i = 0; i You will block the JS execution and your next tick will happen when the loop finishes. Using new Date().getTime() should do the job. Edited for formatting.

I fixed that, thanks :)
Post reply on HN