Last active
December 24, 2015 23:59
-
-
Save cpuguy83/6884647 to your computer and use it in GitHub Desktop.
Poll returns immediately after the page is loaded for some reason... any ideas?
This file contains 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
@Poller = | |
delay: (ms, func) -> setTimeout func, ms | |
poll: (url,time)-> | |
@schedulePoll(url, time) | |
$.getScript(url) | |
schedulePoll: (url, time=30000) -> | |
poller = @delay(time, =>@poll(url, time)) | |
$(document).on 'page:fetch', => | |
clearTimeout(poller) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment