mega.events.onStatusChange()
Last updated
Subscribe to connection state transitions and keep your app's wallet state synced. Fires whenever the wallet status changes — including disconnects initiated from within the wallet UI itself.
mega.events.onStatusChange(callback: (status: ConnectionStatus) => void): void
callback
(status: ConnectionStatus) => void
required
Fires on every status transition.
mega.events.onStatusChange((status) => {
console.log(status.status, status.address);
if (status.status === 'disconnected') {
// Disable transaction actions until reconnect.
}
});void — the subscription is registered immediately.
The callback is stored as a single handler, not a multi-listener event bus. Subscribe once and fan out through your app store if multiple components need the value.
Subscribing replaces any previous handler — register early (e.g., immediately after mega.initialise()) before other code might want to overwrite it.
Last updated