loaded event when loaded from persistence adapter
This commit is contained in:
12
src/Y.js
12
src/Y.js
@@ -21,9 +21,12 @@ import { addStruct as addType } from './Util/structReferences.js'
|
||||
import debug from 'debug'
|
||||
import Transaction from './Transaction.js'
|
||||
|
||||
import YIndexedDB from '../../y-indexeddb/src/y-indexeddb.js'
|
||||
|
||||
export default class Y extends NamedEventHandler {
|
||||
constructor (opts, persistence) {
|
||||
super()
|
||||
this._loaded = false
|
||||
this._opts = opts
|
||||
this.userID = opts._userID != null ? opts._userID : generateUserID()
|
||||
this.share = {}
|
||||
@@ -47,6 +50,15 @@ export default class Y extends NamedEventHandler {
|
||||
initConnection()
|
||||
}
|
||||
}
|
||||
get loaded () {
|
||||
return this._loaded
|
||||
}
|
||||
set loaded (val) {
|
||||
if (this._loaded === false && val) {
|
||||
this._loaded = true
|
||||
this.emit('loaded')
|
||||
}
|
||||
}
|
||||
_beforeChange () {}
|
||||
transact (f, remote = false) {
|
||||
let initialCall = this._transaction === null
|
||||
|
||||
Reference in New Issue
Block a user