Skip to content

Commit a571dcc

Browse files
Remove Event Subscription and Cleanup section
- Remove Event Subscription and Cleanup section per user feedback - Keep focus on core AppKit events, event arguments, and practical use cases - Maintain thread safety information in main introduction Co-Authored-By: gleb@reown.com <gleb@skibitsky.com>
1 parent 221bf7f commit a571dcc

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

appkit/unity/core/events.mdx

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -67,49 +67,6 @@ Empty event arguments indicating account disconnection.
6767
- `Chain PreviousChain` - The previously active chain (can be null)
6868
- `Chain NewChain` - The newly active chain
6969

70-
## Event Subscription and Cleanup
71-
72-
Always unsubscribe from events to prevent memory leaks:
73-
74-
```csharp
75-
public class WalletManager : MonoBehaviour
76-
{
77-
private void OnEnable()
78-
{
79-
// Subscribe to events
80-
AppKit.AccountConnected += OnAccountConnected;
81-
AppKit.AccountDisconnected += OnAccountDisconnected;
82-
AppKit.ChainChanged += OnChainChanged;
83-
}
84-
85-
private void OnDisable()
86-
{
87-
// Unsubscribe from events
88-
AppKit.AccountConnected -= OnAccountConnected;
89-
AppKit.AccountDisconnected -= OnAccountDisconnected;
90-
AppKit.ChainChanged -= OnChainChanged;
91-
}
92-
93-
private void OnAccountConnected(object sender, Connector.AccountConnectedEventArgs e)
94-
{
95-
// Handle account connection
96-
UpdateUI(e.Account);
97-
}
98-
99-
private void OnAccountDisconnected(object sender, Connector.AccountDisconnectedEventArgs e)
100-
{
101-
// Handle account disconnection
102-
ClearUI();
103-
}
104-
105-
private void OnChainChanged(object sender, NetworkController.ChainChangedEventArgs e)
106-
{
107-
// Handle chain change
108-
UpdateChainUI(e.NewChain);
109-
}
110-
}
111-
```
112-
11370
## Common Use Cases
11471

11572
### Updating UI on Account Changes

0 commit comments

Comments
 (0)