@mocanvas/editor · interface

InstancePresence

interface InstancePresence

What one other person is doing right now: where their cursor is, what they have selected, which page they are on.

Presence records live in the presence scope: they are shared with collaborators but never written to a .tldr file and never enter history.


Properties · 15

brush: {
camera: {

Where their viewport is, or null for a collaborator that has no camera — an agent acting on the board. Distinct from a camera parked at the origin.

chatMessage: string
color: string

CSS colour used for their cursor, name chip and selection outlines.

currentPageId: PageId
cursor: {

Where their pointer is, or null for a collaborator that has no pointer at all — an agent acting on the board, or a viewer whose pointer has left the canvas. A cursor parked at the origin is not the same thing as no cursor.

followingUserId: UserId | null
readonly id: InstancePresenceId
lastActivityTimestamp: number

Date.now() on the sender when the record was produced.

meta: JsonObject
scribbles: Scribble[]
selectedShapeIds: ShapeId[]
readonly typeName: "instance_presence"
userId: UserId

Stable id of the person (survives reconnects; one person may have many tabs). A branded UserId, not a bare string: a presence record carries a *user* id and a *presence record* id side by side, and the two were far too easy to swap. Mint one with createUserId.

userName: string

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.