From fdbb558ce25df6d076a0e92a6e4313b97802b0db Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Mon, 11 Sep 2017 16:02:19 +0200 Subject: [PATCH] persistence db fixes --- examples/yjs-dist.esm | 3 ++- src/y.js | 13 +++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/examples/yjs-dist.esm b/examples/yjs-dist.esm index 44ae6624..4434e027 100644 --- a/examples/yjs-dist.esm +++ b/examples/yjs-dist.esm @@ -1,11 +1,12 @@ import Y from '../src/y.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 yText from '../../y-text/src/Text.js' import yXml from '../../y-xml/src/y-xml.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 diff --git a/src/y.js b/src/y.js index 07403e3a..359afbaf 100644 --- a/src/y.js +++ b/src/y.js @@ -150,6 +150,9 @@ export default function Y (opts/* :YOptions */) /* :Promise */ { } }, opts.timeout) } + if (yconfig.persistence != null) { + yconfig.persistence.retrieveContent() + } yconfig.db.whenUserIdSet(function () { yconfig.init(function () { resolved = true @@ -200,14 +203,8 @@ class YConfig extends Y.utils.NamedEventHandler { 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() - .then(callback) - } + this.db.whenTransactionsFinished() + .then(callback) } isConnected () { return this.connector.isSynced