-
Notifications
You must be signed in to change notification settings - Fork 536
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
refactor(presence-tracker): Use presence package #23020
refactor(presence-tracker): Use presence package #23020
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.
For reference here is branch where I updated Presence to have legacy support and then migrated example's MouseTracker. (I left FocusTracker alone just so there were parallel examples of Signals versus Presence.) |
@@ -2,9 +2,17 @@ | |||
|
|||
**_This demo is a work-in-progress_** | |||
|
|||
**Presence Tracker** is an example that demonstrates how transient state of audience members can be tracked among other audience members using signals. It does so using fluid-framework's `FluidContainer`, `IServiceAudience`, and `Signaler`. | |||
**Presence Tracker** is an example that demonstrates how the @fluidframework/presence package can be used to share data |
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.
Nit: I always recommend line-breaking along sentence boundaries for ease of reviewing future content changes.
// Define the schema of our Container. | ||
// This includes the DataObjects we support and any initial DataObjects we want created | ||
// when the Container is first created. |
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.
Nit: any reason this shouldn't be a TSDoc comment?
/** | ||
* A states workspace that the FocusTracker will use to share focus states with other session clients. | ||
*/ | ||
readonly statesWorkspace: PresenceStates<any>, |
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.
any
? {}
with a lint disable is better than any
.
At one point I think I had a type for empty states (PresenceStates<{}>
) because we get {}
complaints. Then most cases disappeared and I removed it as likely hard to discover and easy enough for any users to declare themselves.
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.
This confuses me a bit. What does PresenceStates<{}>
represent? I thought it was "an empty workspace," but the trackers accept a workspace that already has a state key defined. Does PresenceStates<{}>
instead represent "a workspace with unknown states?"
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.
I tried unknown
but that wasn't permitted type-wise.
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.
Back to {}
.
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.
{}
is the correct type. It is a workspace with no defined entries. In this case it is a lint rule that is overzealous. (There are special treatments for {}
in TypeScript, but in this case, I think we know what we are doing.)
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output
|
Summary of changes
The presence-tracker example has been updated to use the presence package. It now uses LatestValueManagers for mouse and focus tracking.
Each client also has a slider that controls the allowable latency of the mouse updates. This enables quick demos of the differences in behavior with higher latencies as well as demonstrating runtime adjustments of the allowable latency.
Known issues: