• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

EcrituresNumeriques / stylo / 12925854411

23 Jan 2025 09:11AM UTC coverage: 25.831% (-4.7%) from 30.523%
12925854411

push

github

web-flow
Merge pull request #1192 from EcrituresNumeriques/feat/vite6

322 of 518 branches covered (62.16%)

Branch coverage included in aggregate %.

3448 of 14077 relevant lines covered (24.49%)

1.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/front/src/components/collaborative/collaborating.js
1
import * as Y from 'yjs'
×
2
import { WebsocketProvider } from 'y-websocket'
×
3
import * as awarenessProtocol from 'y-protocols/awareness.js'
×
4

5
const noop = () => {}
×
6

7
export function connect({
×
8
  roomName,
×
9
  websocketEndpoint,
×
10
  user,
×
11
  onChange = noop,
×
12
  onConnection = noop,
×
13
  onStatusUpdated = noop,
×
14
  onConnectionError = noop,
×
15
  onConnectionClosed = noop,
×
16
}) {
×
17
  const doc = new Y.Doc()
×
18
  const awareness = new awarenessProtocol.Awareness(doc)
×
19
  const wsProvider = new WebsocketProvider(websocketEndpoint, roomName, doc, {
×
20
    // Specify an existing Awareness instance - see https://github.com/yjs/y-protocols
×
21
    awareness: awareness,
×
22
  })
×
23

24
  awareness.on('change', (change, transactionOrigin) => {
×
25
    onChange({
×
26
      states: awareness.getStates(),
×
27
      // args
×
28
    })
×
29
  })
×
30

31
  wsProvider.once('sync', () =>
×
32
    onConnection({
×
33
      states: awareness.getStates(),
×
34
    })
×
35
  )
×
36
  wsProvider.on('status', function (event) {
×
37
    onStatusUpdated(event.status)
×
38
  })
×
39
  wsProvider.on('connection-close', function (wsClosedEvent) {
×
40
    onConnectionClosed(wsClosedEvent)
×
41
  })
×
42
  wsProvider.on('connection-error', function (wsErrorEvent) {
×
43
    onConnectionError(wsErrorEvent)
×
44
  })
×
45

46
  awareness.setLocalState({ user })
×
47

48
  return {
×
49
    doc,
×
50
    wsProvider,
×
51
    awareness,
×
52
  }
×
53
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc