persistence db fixes
This commit is contained in:
parent
76ad58bb59
commit
fdbb558ce2
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
import Y from '../src/y.js'
|
import Y from '../src/y.js'
|
||||||
import yArray from '../../y-array/src/y-array.js'
|
import yArray from '../../y-array/src/y-array.js'
|
||||||
|
import yIndexedDB from '../../y-indexeddb/src/y-indexeddb.js'
|
||||||
import yMap from '../../y-map/src/y-map.js'
|
import yMap from '../../y-map/src/y-map.js'
|
||||||
import yText from '../../y-text/src/Text.js'
|
import yText from '../../y-text/src/Text.js'
|
||||||
import yXml from '../../y-xml/src/y-xml.js'
|
import yXml from '../../y-xml/src/y-xml.js'
|
||||||
import yWebsocketsClient from '../../y-websockets-client/src/y-websockets-client.js'
|
import yWebsocketsClient from '../../y-websockets-client/src/y-websockets-client.js'
|
||||||
|
|
||||||
Y.extend(yArray, yMap, yText, yXml, yWebsocketsClient)
|
Y.extend(yArray, yIndexedDB, yMap, yText, yXml, yWebsocketsClient)
|
||||||
|
|
||||||
export default Y
|
export default Y
|
||||||
|
9
src/y.js
9
src/y.js
@ -150,6 +150,9 @@ export default function Y (opts/* :YOptions */) /* :Promise<YConfig> */ {
|
|||||||
}
|
}
|
||||||
}, opts.timeout)
|
}, opts.timeout)
|
||||||
}
|
}
|
||||||
|
if (yconfig.persistence != null) {
|
||||||
|
yconfig.persistence.retrieveContent()
|
||||||
|
}
|
||||||
yconfig.db.whenUserIdSet(function () {
|
yconfig.db.whenUserIdSet(function () {
|
||||||
yconfig.init(function () {
|
yconfig.init(function () {
|
||||||
resolved = true
|
resolved = true
|
||||||
@ -200,15 +203,9 @@ class YConfig extends Y.utils.NamedEventHandler {
|
|||||||
share[propertyname] = this.store.initType.call(this, id, args)
|
share[propertyname] = this.store.initType.call(this, id, args)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (this.persistence != null) {
|
|
||||||
this.persistence.retrieveContent()
|
|
||||||
.then(() => this.db.whenTransactionsFinished())
|
|
||||||
.then(callback)
|
|
||||||
} else {
|
|
||||||
this.db.whenTransactionsFinished()
|
this.db.whenTransactionsFinished()
|
||||||
.then(callback)
|
.then(callback)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
isConnected () {
|
isConnected () {
|
||||||
return this.connector.isSynced
|
return this.connector.isSynced
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user