Skip to content

Commit

Permalink
fix: hack add timer to fix window.nostr not always available on mount
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolu89 committed Jul 18, 2023
1 parent 2f2e717 commit 63e93c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nostr-one",
"description": "The last button you will ever need to login with Nostr",
"private": false,
"version": "0.0.2",
"version": "0.0.3",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
Expand Down
10 changes: 7 additions & 3 deletions src/components/nostr-one.ce.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ declare global {
}
onMounted(() => {
if (window.nostr) {
nip07Enabled.value = true;
}
// Hack: window.nostr is not always available on mount
const timeout = setTimeout(() => {
if (window.nostr) {
nip07Enabled.value = true;
}
clearTimeout(timeout);
}, 100);
});
const nip07Enabled = ref<boolean>(false);
Expand Down

0 comments on commit 63e93c6

Please sign in to comment.