Sha256: a8e042d477eed5315f161b8ec7178c4c9d42a2cffcf7f539c2cb7ad08b04b1be
Contents?: true
Size: 881 Bytes
Versions: 8
Compression:
Stored size: 881 Bytes
Contents
#= require jquery.pjax class AssessmentNotification constructor: -> @enable() enable: -> $(document).on "submit", "form[data-pjax]", (event) -> $.pjax.submit event, "[data-pjax-container]" $(window).on "beforeunload", => @sendNotification() $(window).on "unload", => @sendNotification() $(document).on "pjax:popstate", (event) -> event.preventDefault() if event.direction == "back" disable: -> $(document).off "submit", "form[data-pjax]" $(window).off("beforeunload").off("unload") sendNotification: -> unless @_sentNotification $.ajax window.location.href + "/notification", method: "POST", async: false @_sentNotification = true `void(0)` _sentNotification: false $ -> if $("form[data-pjax]").length and $.support.pjax window.assessmentNotification = new AssessmentNotification()
Version data entries
8 entries across 8 versions & 1 rubygems