Skip to content

Instantly share code, notes, and snippets.

@smombartz
Last active March 3, 2022 00:02
Show Gist options
  • Save smombartz/7ad643db152a48391e5c1f9f667febb8 to your computer and use it in GitHub Desktop.
Save smombartz/7ad643db152a48391e5c1f9f667febb8 to your computer and use it in GitHub Desktop.
<!-- Unlock Event Handler -->
<script>
window.addEventListener('unlockProtocol.status', function(event) {
// We hide all .unlock-content elements
document.querySelectorAll('.unlock-content').forEach((element) => {
element.style.display = "none"
})
// We show only the relevant element
document.querySelectorAll(`.unlock-content.${event.detail.state}`).forEach((element) => {
element.style.display = "block"
})
})
window.addEventListener('unlockProtocol.authenticated', function(event) {
// event.detail.addresss includes the address of the current user, when known
})
window.addEventListener('unlockProtocol.transactionSent', function(event) {
// event.detail.hash includes the hash of the transaction sent
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment