add AbstractConnector interface - implements #215
This commit is contained in:
parent
dc136ff56a
commit
0b8f032364
@ -67,5 +67,6 @@ export {
|
||||
equalSnapshots,
|
||||
PermanentUserData, // @TODO experimental
|
||||
tryGc,
|
||||
transact
|
||||
transact,
|
||||
AbstractConnector
|
||||
} from './internals.js'
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
export * from './utils/AbstractConnector.js'
|
||||
export * from './utils/DeleteSet.js'
|
||||
export * from './utils/Doc.js'
|
||||
export * from './utils/UpdateDecoder.js'
|
||||
|
26
src/utils/AbstractConnector.js
Normal file
26
src/utils/AbstractConnector.js
Normal 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
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user