Created
December 14, 2021 16:02
-
-
Save fnnzzz/e0efaf53bcd286e55ac34f6cd28cf9d7 to your computer and use it in GitHub Desktop.
transfer state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var markup = document.querySelector('#app-desktop-state').textContent | |
function unescapeHtml(text) { | |
const unescapedText = { | |
'&a;': '&', | |
'&q;': '"', | |
'&s;': '\'', | |
'&l;': '<', | |
'&g;': '>', | |
}; | |
return text.replace(/&[^;]+;/g, s => unescapedText[s]); | |
} | |
initialState = JSON.parse(unescapeHtml(markup)) | |
// console.log(initialState) | |
var filteredKeys = Object.keys(initialState) | |
filteredKeys.forEach(key => { | |
console.groupCollapsed(key) | |
console.log(initialState[key]) | |
console.groupEnd() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment