For the complete documentation index, see llms.txt. This page is also available as Markdown.

mega.events.onStatusChange()

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.

Signature

mega.events.onStatusChange(callback: (status: ConnectionStatus) => void): void

Parameters

Field
Type
Required
Notes

callback

(status: ConnectionStatus) => void

required

Fires on every status transition.

Example

mega.events.onStatusChange((status) => {
  console.log(status.status, status.address);

  if (status.status === 'disconnected') {
    // Disable transaction actions until reconnect.
  }
});

Response

void — the subscription is registered immediately.

Notes

  • 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