diff --git a/web/index.html b/web/index.html index 457cbae..27aff02 100644 --- a/web/index.html +++ b/web/index.html @@ -18,11 +18,8 @@ diff --git a/web/js/damus.js b/web/js/damus.js index bb7b704..0e9cd47 100644 --- a/web/js/damus.js +++ b/web/js/damus.js @@ -120,6 +120,26 @@ function notice_chatroom(state, id) } async function damus_web_init() +{ + init_message_textareas(); + + let tries = 0; + function init() { + // only wait for 500ms max + const max_wait = 500 + const interval = 20 + if (window.nostr || tries >= (max_wait/interval)) { + console.info("init after", tries); + damus_web_init_ready(); + return; + } + tries++; + setTimeout(init, interval); + } + init(); +} + +async function damus_web_init_ready() { const model = init_home_model() DAMUS = model