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