rtfsf / rtfsf.github.io

Restore the Fourth SF
1 stars 0 forks source link

Find a better solution than setInterval #4

Open nickdesaulniers opened 11 years ago

nickdesaulniers commented 11 years ago

the setInterval code is brittle and really needs to go. Find a way to resize without having this code run 5 times a second when it's only needed once (after an event perhaps).

RoboTeddy commented 11 years ago

Grumble, my Comcast connection died. On phone. Was rushing to get map working before Caltrain, hence setInterval.

At first was relying on window resize and document ready events, but a purely event-based approach would probably requiring finding an event/callback for Bootstrap's navigation bar toggle completion. I'm sure there is one-- would google for it if had Internet.

Sidenote: although ugly, the setInterval in this case is probably pretty reliable and won't cause performance problems in practice (it's a cheap idempotent call). But I wouldn't complain to see it gone!