web: Added interval checking for nos2x

This commit is contained in:
Thomas Mathews 2022-11-18 08:51:52 -08:00 committed by William Casarin
parent 72346522eb
commit ef1c2ca525
2 changed files with 21 additions and 4 deletions

View file

@ -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