 
   loadResponse: (response) ->
     @view.loadHTML(response)
+    @notifyApplicationOfPageChange()
 
   # Page snapshots
 


  # Event handlers

  clickCaptured: =>
    removeEventListener("click", @clickBubbled, false)
    addEventListener("click", @clickBubbled, false)

  clickBubbled: (event) =>
    if not event.defaultPrevented and location = @getVisitableLocationForEvent(event)
      if @triggerEvent("page:before-change", data: { url: location }, cancelable: true)
        event.preventDefault()
        @visit(location)

  # Events

  triggerEvent: (eventName, {cancelable, data} = {}) ->
    event = document.createEvent("events")
    event.initEvent(eventName, true, cancelable is true)
    event.data = data
    document.dispatchEvent(event)
    not event.defaultPrevented

  # Private

  getVisitableLocationForEvent: (event) ->
    link = Turbolinks.closest(event.target, "a")

  start: ->
    unless @started
      addEventListener("click", @clickCaptured, true)
      addEventListener("DOMContentLoaded", @pageLoaded, false)
      @history.start()
      @started = true

  stop: ->
    if @started
      removeEventListener("click", @clickCaptured, true)
      removeEventListener("DOMContentLoaded", @pageLoaded, false)
      @history.stop()
      @started = false

