add AbstractConnector interface - implements #215

This commit is contained in:
Kevin Jahns 2020-07-12 19:07:16 +02:00
parent dc136ff56a
commit 0b8f032364
3 changed files with 29 additions and 1 deletions

View File

@ -67,5 +67,6 @@ export {
equalSnapshots,
PermanentUserData, // @TODO experimental
tryGc,
transact
transact,
AbstractConnector
} from './internals.js'

View File

@ -1,4 +1,5 @@
export * from './utils/AbstractConnector.js'
export * from './utils/DeleteSet.js'
export * from './utils/Doc.js'
export * from './utils/UpdateDecoder.js'

View File

@ -0,0 +1,26 @@
import { Observable } from 'lib0/observable.js'
import {
Doc // eslint-disable-line
} from '../internals.js'
/**
* This is an abstract interface that all Connectors should implement to keep them interchangeable.
*
* @note This interface is experimental and it is not advised to actually inherit this class.
* It just serves as typing information.
*
* @extends {Observable<any>}
*/
export class AbstractConnector extends Observable {
/**
* @param {Doc} ydoc
* @param {any} awareness
*/
constructor (ydoc, awareness) {
super()
this.doc = ydoc
this.awareness = awareness
}
}