JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 571721
  • Score
    100M100P100Q171970F
  • License MIT

Yjs encoding protocols

Package Exports

  • y-protocols/auth.js
  • y-protocols/awareness
  • y-protocols/awareness.js
  • y-protocols/dist/auth.js
  • y-protocols/dist/awareness.js
  • y-protocols/dist/sync.js
  • y-protocols/sync
  • y-protocols/sync.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (y-protocols) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Yjs Protocols

Binary encoding protocols for syncing, awareness, and history inforamtion

This API is unstable and subject to change.

API

Awareness Protocoll

import * as awarenessProtocol from 'y-protocols/awareness.js'

awarenessProtocol.Awareness Class

The Awareness class implements a simple network agnostic protocol to propagate awareness information like cursor, username, or status. Each client can update its own local state and listen to state changes of remote clients.

const awareness = new awarenessProtocol.Awareness()
getLocalState():Object<string,any>|null
Get the local awareness state.
setLocalState(Object<string,any>|null)
Set/Update the local awareness state. Set `null` to mark the local client as offline.
setLocalStateField(string, any)
Only update a single field on the local awareness object. Does not do anything if the local state is not set.
getStates():Map<number,Object<string,any>>
Get all client awareness states (remote and local). Maps from clientID to awareness state.
on('change', ({ added: Array<number>, updated: Array<number> removed: Array<number> }, [transactionOrigin:any]) => ..)
Listen to remote and local changes on the awareness instance.

License

The MIT License © Kevin Jahns