Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Hulbert <[email protected]>
  • Loading branch information
dpiatek and m-hulbert authored Jul 21, 2023
1 parent 86a8079 commit 77ac296
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/class-definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ Handles tracking of member cursors within a space. Inherits from [EventEmitter](
Set the position of a cursor. This will emit a `CursorUpdate` event. If a member has not yet entered the space, this method will error.
`CursorUpdate` is an object with 2 properties. `position` is an object with 2 required properties, `x` and `y`. These represent the position of the cursor on a 2D plane. A second property, `data` can passed. This is an object of any shape and is meant for data associated with the cursor movement (like drag or hover calculation results):
A `CursorUpdate` is an object with 2 properties. `position` is an object with 2 required properties, `x` and `y`. These represent the position of the cursor on a 2D plane. A second optional property, `data` can also be passed. This is an object of any shape and is meant for data associated with the cursor movement (like drag or hover calculation results):
```ts
type set = (update: { position: CursorPosition, data?: CursorData })
Expand Down Expand Up @@ -420,7 +420,7 @@ const lastPositions = space.cursors.getAll();
### on
Listen to cursor update events. See [EventEmitter](/docs/usage.md#event-emitters) for overloading usage.
Listen to `CursorUpdate` events. See [EventEmitter](/docs/usage.md#event-emitters) for overloading usage.
Available events:
Expand Down
4 changes: 2 additions & 2 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ The listener will be called with a `CursorUpdate`:
}
```

To set cursor updates, first enter the space:
To set the position of a cursor and emit a `CursorUpdate`, first enter the space:

```ts
space.enter();
Expand All @@ -323,7 +323,7 @@ window.addEventListner('mousemove', ({ clientX, clientY }) => {

To retrieve the initial position and data of all cursors within a space, you can use the `space.cursors.getAll()` method. This returns an object keyed by `connectionId`. The value is the last `cursorUpdate` set by the given `connectionId`.

Example of calling `getAll` to return all cursor positions:
Example of calling `getAll()` to return all cursor positions:

```ts
const lastPositions = await space.cursors.getAll();
Expand Down

0 comments on commit 77ac296

Please sign in to comment.