[feat] Events to notify web app about state changes
rikublock opened this issue · comments
Add an event system that allows web apps to react to extension state changes. It's currently quite difficult to stay in sync with what is happening with the extension without constantly polling the state.
Possibly something based on Node.js EventEmitter.
Example:
- networkChanged: switch from "devnet" to "testnet"
- walletChanged / accountChanged: selected new active wallet
- login, logout: extension locked or unlocked
- etc.
Usage:
GemWalletApi.on('networkChanged', (network: string) => {
console.log(`New network: ${network}`);
});
Hi @rikublock,
That's a really good feedback, let us working on it in our next releases.
Thank you so much for your feedbacks.
@all-contributors add @rikublock for bug and ideas
I've put up a pull request to add @rikublock! 🎉
Hi @rikublock, just to let you know that the change got merged to master, thanks for the suggestion.
We will be planning a release pretty soon to make the changes live.
Hi @rikublock, just to let you know that the change got merged to master, thanks for the suggestion. We will be planning a release pretty soon to make the changes live.
Cheers. Will give it a try once the docs are updated.
Hi @rikublock,
The doc has been updated.
@FlorianBouron @ThibautBremand Got to say. You guys keep pushing these changes so quickly. I'm just amazed! Keep up the good work.
@rikublock Thank you! :)