Skip to content

Commit

Permalink
fix: typo (supabase#28724)
Browse files Browse the repository at this point in the history
* fix: typo

* fix: prettier

---------

Co-authored-by: Francesco Sansalvadore <[email protected]>
  • Loading branch information
periakteon and fsansalvadore authored Aug 24, 2024
1 parent e77f8b9 commit 90ed06b
Showing 1 changed file with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,31 +89,28 @@ const MOUSE_EVENT = 'cursor'
// Subscribe to mouse events.
// Our second parameter filters only for mouse events.
channel
.on(
'broadcast',
{ event: MOUSE_EVENT },
(event) => { receivedCursorPosition(event) }
)
.subscribe()
.on('broadcast', { event: MOUSE_EVENT }, (event) => {
receivedCursorPosition(event)
})
.subscribe()

// Handle a mouse event.
const receivedCursorPosition({ event, payload }) => {
console.log(`
const receivedCursorPosition = ({ event, payload }) => {
console.log(`
User: ${payload.userId}
x Position: ${payload.x}
y Position: ${payload.y}
`)
}

// Helper function for sending our own mouse position.
const sendMousePosition(channel, userId, x, y) => {
return channel.send({
type: 'broadcast',
event: MOUSE_EVENT,
payload: { userId, x, y }
})
const sendMousePosition = (channel, userId, x, y) => {
return channel.send({
type: 'broadcast',
event: MOUSE_EVENT,
payload: { userId, x, y },
})
}

```

### Presence Example
Expand Down

0 comments on commit 90ed06b

Please sign in to comment.