Sha256: 12b07b3327da9105623dc12f7ef9b4fbe6b84dc8e18cca63709545494127abba

Contents?: true

Size: 601 Bytes

Versions: 15

Compression:

Stored size: 601 Bytes

Contents

jQuery ->
  poll_interval = 2

  poll_start = (el) ->
    href = el.attr("href")
    el.parent().text "Starting..."
    $("#main").addClass "polling"
    setInterval (->
      $.ajax
        dataType: "text"
        type: "get"
        url: href
        success: (data) ->
          $("#main").html data
          $("#main .time").relativeDate()
    ), poll_interval * 1000
    location.hash = "#poll"

  # auto start if hash is poll
  poll_start $("a[rel=poll]")  if location.hash == "#poll"

  # start when click on link
  $("a[rel=poll]").click (e) ->
    e.preventDefault()
    poll_start $(this)

Version data entries

15 entries across 15 versions & 5 rubygems

Version Path
resque-web-0.0.12 app/assets/javascripts/resque_web/polling.js.coffee
resque-web-0.0.11 app/assets/javascripts/resque_web/polling.js.coffee
resque-web-0.0.10 app/assets/javascripts/resque_web/polling.js.coffee
misha-resque-web-0.1.1 app/assets/javascripts/resque_web/polling.js.coffee
misha-resque-web-0.1.0 app/assets/javascripts/resque_web/polling.js.coffee
misha-resque-web-0.0.9 app/assets/javascripts/resque_web/polling.js.coffee
resque-web-0.0.9 app/assets/javascripts/resque_web/polling.js.coffee
resque-web-0.0.8 app/assets/javascripts/resque_web/polling.js.coffee
resque-web-edge-1.0.0 app/assets/javascripts/resque_web/polling.js.coffee
resque-web-0.0.7 app/assets/javascripts/resque_web/polling.js.coffee
resque-web-clone-0.0.7 app/assets/javascripts/resque_web/polling.js.coffee
resque-web-clone-0.0.6 app/assets/javascripts/resque_web/polling.js.coffee
resque-web-0.0.6 app/assets/javascripts/resque_web/polling.js.coffee
glebtv_resque_web-0.1.0 app/assets/javascripts/resque_web/polling.js.coffee
resque-web-0.0.5 app/assets/javascripts/resque_web/polling.js.coffee