FriendsEvents
Interface: FriendsEvents
Defined in: api/friends/events.ts:54
Map of event name → callback signature for IFriendsManager.on. The callback's argument type narrows automatically per event key via TypeScript's keyof inference.
Remarks
Event names use a : namespace separator — "request:received",
"friend:added", etc. — so the keyspace stays organized as the API
grows. Friends events centre on graph mutations + inbox transitions.
Currently wired:
request:received— fires when a NEW entry appears in the bundle'sstate.user.incomingFriendRequestsMap (i.e. someone sent us a friend request and the nextIncomingFriendSyncpoll surfaced it). Note: poll-driven under the hood — fires after the bundle's periodic sync, not on a real-time push from Snap.request:cancelled— fires when a sender revokes an inbound request that was in ourreceivedslot (the entry disappears fromincomingFriendRequestswithout us having accepted / rejected it).request:accepted— fires when a userId we sent a request to becomes mutual: it leavesoutgoingFriendRequestIdsand appears inmutuallyConfirmedFriendIdson the same tick. Note: also firesfriend:addedfor the same id — semantics are distinct (this one is "they accepted my add",friend:addedis "this id is now in the mutuals list").friend:added— fires when a userId newly appears inmutuallyConfirmedFriendIds.friend:removed— fires when a userId leavesmutuallyConfirmedFriendIds(unfriend / block).change— fires whenever any of the three friend-graph slots (mutuals / received / sent) mutates. Same payload asonChange.
Persistence note: the four diff-style events
(friend:added / friend:removed / request:received /
request:cancelled / request:accepted) are powered by a shared
watcher that diffs the current friend graph against a persisted
snapshot in the DataStore. This means deltas that happened while
the SDK was offline will REPLAY on the next refresh / state tick
after startup — subscribers should be idempotent over redeliveries.
Properties
| Property | Type | Defined in |
|---|---|---|
change | (snapshot: FriendsSnapshot) => void | api/friends/events.ts:60 |
friend:added | (friend: Friend) => void | api/friends/events.ts:58 |
friend:removed | (userId: string) => void | api/friends/events.ts:59 |
request:accepted | (userId: string) => void | api/friends/events.ts:57 |
request:cancelled | (userId: string) => void | api/friends/events.ts:56 |
request:received | (req: ReceivedRequest) => void | api/friends/events.ts:55 |