-window.historyCache = []
-window.testArray = []
+@historyCache = []
+
 visit = (url) ->
   if browserSupportsPushState?
+    @historyCache.push({url:document.location.href,body:document.body,title:document.title})
     reflectNewUrl url
     fetchReplacement url
   else

rememberInitialPage = ->
  window.history.replaceState { turbolinks: true }, "", document.location.href


if browserSupportsPushState
  rememberInitialPage()



replaceDocument = (body,title,cache) ->
  originalBody = document.body
  document.documentElement.appendChild body, originalBody
  document.documentElement.removeChild originalBody
  document.title = title


extractLink = (event) ->
