Add Activity View API
- Dominant language
- TypeScript
- Stars
- 12
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
This will be the api that drives the activities views. The idea here is to make a scalable and straightforward way to build activities with friends making video chat a first class citizen.
```
ActivityState: { // Available Globally
peers: Peer[]; // All active peers
activePeerIds: string[]; // All active peer ids
selectedPeerId: string; // The currently selected peer id
timer: null | number; // null if not set
}
Events:
onPeerAdded(peer)
onPeerRemoved(peer)
onPeerSelected(prevSelectedPeer, nextSelectedPeer)
onTimerStarted(activityState)
onTimerFinished(activityState)
onActivityStart(activityState)
onNext(activityState)
Actions:
getActivePeersLength();
getRandomNumber(min, max);
selectPeer(peer.id)
selectNextPeer()
selectPreviousPeer()
selectRandomPeer()
movePeerToPosition(peerId, position)
setPeerText(peerId, text);
setCenterText(text);
setTimer(time);
setActivePeers(peerIds)
forEachActivePeer();
requestText();
// Guess Who Game
{
onActivityStart(() => {
forEachActivePeer((peer) => {
requestText(() => setPeerText(peer.id));
})
selectRandomPeer();
}),
onPeerSelected((prev, next) => {
movePeerToPosition('center');
setCenterText(next.peerText);
}),
onNext(() => {
selectNextPeer();
})
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.