Overview
The WeaveUsersPresencePlugin class that enables real-time sharing of operations data (drag, transform, etc.) across all connected users on the collaborative canvas. It will then display this changes as awareness without merging them on the room state.
This plugin helps create a shared sense of presence, making collaborative tools feel dynamic, interactive, and truly multi-user.
The class extends the WeavePlugin class
TypeScript types
type WeaveUser = {
[key: string]: any;
name: string;
email: string;
};
type WeaveUsersPresencePluginConfig = {
awarenessThrottleMs: number;
getUser: () => WeaveUser;
};
type WeaveUsersPresencePluginParams = {
config: Pick<WeaveUsersPresencePluginConfig, "getUser"> &
Partial<Omit<WeaveUsersPresencePluginConfig, "getUser">>;
};
type WeaveUserPresenceInformation = Record<string, WeaveUserPresence<unknown>>;
type WeaveUserPresence<T> = {
userId: string;
nodeId: string;
attrs: T;
};
type WeaveUserPresenceKey = typeof WEAVE_USER_PRESENCE_KEY;
Parameters
For WeaveUsersPresencePluginParams:
| Property | Type | Required | Description |
|---|---|---|---|
|
|
Config parameters for the plugin. |
For WeaveUsersPresencePluginConfig:
| Property | Type | Required | Description |
|---|---|---|---|
|
|
A function that returns the actual instance user metadata. |