basics of new popup are good to go

This commit is contained in:
Jack Case
2025-11-16 23:25:27 +00:00
parent 32b0994076
commit b55c47d5f1
3 changed files with 21 additions and 13 deletions

View File

@@ -181,7 +181,7 @@ async function update_page_action_icon(details: browser.webNavigation._OnCommitt
console.log(is_slop)
}
async function message_listener(message: any, sender: any, send_response: Function) {
function message_listener(message: any, sender: any, send_response: Function): Promise<any> {
switch (message.type) {
case "check":
@@ -200,22 +200,28 @@ async function message_listener(message: any, sender: any, send_response: Functi
}))
})
await Promise.all(check_promises)
const result = Promise.all(check_promises).then(() => {
let remote_slop = check_remote_slop(not_found_local)
remote_slop.then((remote_results) => {
remote_results.forEach((result: any) => {
browser.tabs.sendMessage(tabid, { type: "check_result", domain: result.domain_name, result: result })
})
})
let remote_slop = await check_remote_slop(not_found_local)
remote_slop.forEach((result: any) => {
browser.tabs.sendMessage(tabid, { type: "check_result", domain: result.domain_name, result: result })
})
return result
break
case "login":
localStorage.setItem("accessToken", message.token)
send_response(true)
return new Promise((resolve, reject) => { resolve(true) })
break
case "islogged":
const token = get_access_token()
send_response(token ? true : false)
const response = { logged_in: token != null ? true : false }
return new Promise((resolve, reject) => { resolve(response) })
break
}
}