Sha256: ba87eef198b30ead20d6973ad5c77a2af11343c559506543eaf4fd75dd00b040

Contents?: true

Size: 579 Bytes

Versions: 8

Compression:

Stored size: 579 Bytes

Contents

#= require jquery.pjax

class AssessmentTimer
  constructor: (@timeoutInterval, @timeout) ->
    @start()

  start: ->
    @timeoutId = window.setTimeout =>
      @timeout()
    , @timeoutInterval * 1000

  restart: ->
    window.clearTimeout @timeoutId
    @start()

$ ->
  if $("[data-timeout]").length and $.support.pjax
    timeoutInterval = parseInt($("[data-timeout]").attr("data-timeout"))
    window.assessmentTimer = new AssessmentTimer timeoutInterval, ->
      window.location.href += "/timeout"

  $(document).on "pjax:send", ->
    window.assessmentTimer.restart()

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
study_engine-0.3.1 app/assets/javascripts/study_engine/assessment_timeout.js.coffee
study_engine-0.3.0 app/assets/javascripts/study_engine/assessment_timeout.js.coffee
study_engine-0.2.2 app/assets/javascripts/study_engine/assessment_timeout.js.coffee
study_engine-0.2.1 app/assets/javascripts/study_engine/assessment_timeout.js.coffee
study_engine-0.2.0 app/assets/javascripts/study_engine/assessment_timeout.js.coffee
study_engine-0.1.1 app/assets/javascripts/study_engine/assessment_timeout.js.coffee
study_engine-0.1.0 app/assets/javascripts/study_engine/assessment_timeout.js.coffee
study_engine-0.0.2 app/assets/javascripts/study_engine/assessment_timeout.js.coffee