-
-
Save JohnnyJumper/4d4c5f655d9b7698cf92d0e039b5e7fa to your computer and use it in GitHub Desktop.
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
function cleanDOM(parent) { | |
while (parent.firstChild) { | |
parent.removeChild(parent.firstChild); | |
} | |
} | |
function displayResolution(resolution) { | |
const {ownerAddress, resolverAddress, records} = resolution; | |
const mainContainer = document.getElementById('records'); | |
cleanDOM(mainContainer); | |
const ownerRecord = document.createElement('span'); | |
ownerRecord.innerHTML = `ownerAddress: ${ownerAddress}`; | |
const resolverRecord = document.createElement('span'); | |
resolverRecord.innerHTML = `resolverAddress: ${resolverAddress}`; | |
mainContainer.appendChild(ownerRecord); | |
mainContainer.appendChild(resolverRecord); | |
Object.entries(records).map(([key, value]) => { | |
const recordSpan = document.createElement('span'); | |
if (!value) { | |
recordSpan.style.color = 'red'; | |
value = `No ${key} found`; | |
} | |
recordSpan.innerHTML = `${key} : ${value}`; | |
mainContainer.appendChild(recordSpan); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment