Skip to content

Commit

Permalink
Merge branch 'kasbah-keep-state'
Browse files Browse the repository at this point in the history
  • Loading branch information
geelen committed Nov 2, 2017
2 parents 66ee37c + 10b901c commit 74f7fc5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Crawler.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ export default class Crawler {
if (strip.exec(url.parse(script.src).path)) script.remove()
})
}
if (Boolean(window.snapshotState)) {
const stateJSON = JSON.stringify(window.snapshotState)
const script = window.document.createElement('script')
script.innerHTML = `window.snapshotState = JSON.parse('${stateJSON}');`
window.document.head.appendChild(script)
}
const html = jsdom.serializeDocument(window.document)
this.extractNewLinks(window, urlPath)
this.handler({ urlPath, html })
Expand Down

0 comments on commit 74f7fc5

Please sign in to comment.