-
Notifications
You must be signed in to change notification settings - Fork 0
feat(realtime): add phoenixAdapter, change RealtimePresence, add github as dependency #2
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
feat(realtime): add phoenixAdapter, change RealtimePresence, add github as dependency #2
Conversation
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.
that's for future I think, but once we expose constants in phoenix fork, if we add something to those constants we should spread original one (and add more) or reexport them from this file for consistency
| /** | ||
| * @private | ||
| */ | ||
| getPresence(): Presence { | ||
| return this.presence | ||
| } |
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.
nitpick: not needed
| * | ||
| */ | ||
| function transformState(state: State): RealtimePresenceState { | ||
| state = cloneDeep(state) |
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.
question: is cloning needed here?
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.
Both of these functions are copied from the RealtimePresence and I haven't changed how they work. Once we have working sutff and tests to ensure nofing breaks we can modify and reafctor already existing code.
| function cloneDeep(obj: { [key: string]: any }) { | ||
| return JSON.parse(JSON.stringify(obj)) | ||
| } |
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.
nitpick: you should make it generic, as this should return the same type on input
| } | ||
|
|
||
| function cloneDeep(obj: { [key: string]: any }) { | ||
| return JSON.parse(JSON.stringify(obj)) |
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.
nitpick: i don't like that method of cloning
maybe this? mdn says it's supported by majors browsers, but we could still polyfill this just in case
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.
same as above
| } | ||
|
|
||
| trigger(type: string, payload: object, ref?: string): void { | ||
| //@ts-ignore - trigger should be public |
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.
Oh okay I thought those were the ones you've added before I made the PR to the subabase/phoenix
| /** | ||
| * @private | ||
| */ | ||
| getChannel(): Channel { | ||
| return this.channel | ||
| } |
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.
these private functions. They are not used in the class so either they should be deleted or made public.
No description provided.