Live data from Hacker News

Start a timer via the url

alrt.io

21–30 of 39 posts

Re: Start a timer via the url

#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.

Re: Start a timer via the url

#25

Simple and cool. How about making the URLs more human readable: alrt.io/2minutes50seconds or alrt.io/2m50s instead of alrt.io/2%20minutes%2050%20seconds The %20 makes it really hard to parse.

Not sure if it's updated since you wrote this, but you can do

    alrt.io/2m50s
Still %20s in long format URLs though

Re: Start a timer via the url

#26
post #20

Now, on alert completion do this: window.location.href = 'nyan.cat'; Neat little app, nice to see a simple non-Flash version of http://e.ggtimer.com

This would be great. It could definitely use a fun alert or a way for a user to make their own alert via some url.

Re: Start a timer via the url

#28
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.

Scrolling in iOS also stops setTimeout being called.

Re: Start a timer via the url

#29
post #25

Simple and cool. How about making the URLs more human readable: alrt.io/2minutes50seconds or alrt.io/2m50s instead of alrt.io/2%20minutes%2050%20seconds The %20 makes it really hard to parse.

Not sure if it's updated since you wrote this, but you can do alrt.io/2m50s Still %20s in long format URLs though

http://alrt.io/2minutes50seconds <- works just fine, or at least it does now.

Re: Start a timer via the url

#30
Cool. I wrote something like this to alert me when its time to pick up my daughter from school. Though in my implementation it starts playing a very annoying alarm (I always have headphones on). Congrats on shipping!
Post reply on HN