-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up room connection status #102
Clean up room connection status #102
Conversation
rejected
status to knock_rejected
bd41371
to
908a4ed
Compare
9c52bbd
to
3adad69
Compare
This state is not used for anything, it should be safe to remove.
... and fix the missing state reset when screen share stops.
Use default localMediaConstraints' audio, video: true.
`useLocalMedia` already has a default option and the same value was passed in the story. This commit removes this unnecessary param.
…articipants` These props are only used internally, so no need to add them to the useRoomConnection state.
3adad69
to
c2f0415
Compare
c2f0415
to
80cd661
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awsome!
Currently elbow deep in typescript trying to make a constructor for these events that types them automatically 😂 😭 type RoomEventKey = keyof RoomEventsMap;
type ArgType<T> = T extends (arg: infer U) => unknown ? U : never;
type RoomEventHandler<T extends RoomEventKey> = RoomEventsMap[T];
type RoomEvent<T extends RoomEventKey> = ArgType<RoomEventHandler<T>>;
type RoomEventPayload<T extends RoomEventKey> = RoomEvent<T> extends CustomEvent<infer U> ? U : never;
function constructCustomEvent<T extends RoomEventKey>(
eventType: T,
eventInitDict: { detail: RoomEventPayload<T> }
): RoomEvent<T> {
return new CustomEvent(eventType, eventInitDict);
} EDIT: OK I got it, was just being too explicit with the types. I'll do up another PR for after this one, as it's purely a typing change (plus a function wrapper) it can wait until after launch |
thin wrappers around CustomEvent that will enforce our payload types on the created events
Type custom event payloads
We dont want to expose the LocalMeda and RoomConnection classes just yet, so leave them out of the exports.
separate module imports
Summary
Clean up SDK's api surface before the beta release.
Changes
accepted
state fromroomConnectionStatus
> This state is not used for anything, it should be safe to remove.
rejected
state toknock_rejected
> Use a more descriptive status name when a knock request gets rejected on a locked room.
roomConnectionStatus
->connectionStatus
mostRecentChatMessage
startScreenshareError
isStartingScreenshare
withlocalScreenshareStatus
and fix the missing state reset when screen share stops> Use default localMediaConstraints' audio, video: true.
>
useLocalMedia
already has a default option and the same value waspassed in the story. This commit removes this unnecessary param.
newJoiner
andstreams
onremoteParticipant
> These are internal props, no need to expose them to in the useRoomConnection's
state
.Test plan
knock:
knock_rejected
screenshare status:
localScreenshareStatus
undefined
starting
active
stopScreenshare
action or by the browser's native alert =>undefined
againuseRoomConnection's default options:
useRoomConnection
with a roomUrl only, likeuseRoomConnection(roomUrl)
newJoiner
andstreams
props inremoteParticipant
console.log
thestate
orstate.remoteParticipants
in your demo appnewJoiner
andstreams
props shouldn't be there.Make sure your demo app works after migrating to this version 😇 .