wallet-adapter
wallet-adapter copied to clipboard
Explore whether mid-session wallet installation is detectable by focus-tracking the Window object
Origin: https://github.com/solana-labs/wallet-adapter/pull/327#issuecomment-1052898918
We want to be able to detect when you've installed a new wallet in the middle of a session. Right now, we poll, every second, forever.
I have a hunch that when you're in the middle of a session, and you install a brand new wallet, the mere act of clicking on the installer UI causes the window to blur
and focus
. If this is so, we should be able to use the fact of that to detect that a wallet has been installed. Just listen for focus
events on window
and do another round of detection for the undetected wallets then!
This is an antidote to having to poll, forever. Polling keeps the process awake, but listening for focus
lets it sleep.
Closing here since polling isn't needed in https://github.com/wallet-standard/wallet-standard