mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-30 09:42:30 +00:00
Fix stores event hook up
This commit is contained in:
parent
b8e3e5397b
commit
c2d2a8a6cc
@ -55,17 +55,15 @@ class OrbitDB {
|
|||||||
_subscribe(store, dbname, subscribe, callback) {
|
_subscribe(store, dbname, subscribe, callback) {
|
||||||
if(subscribe === undefined) subscribe = true;
|
if(subscribe === undefined) subscribe = true;
|
||||||
|
|
||||||
return store.use(this.user.username).then((events) => {
|
store.events.on('readable', this._onSync.bind(this));
|
||||||
events.on('readable', this._onSync.bind(this));
|
store.events.on('data', this._onWrite.bind(this));
|
||||||
events.on('data', this._onWrite.bind(this));
|
store.events.on('load', this._onLoad.bind(this));
|
||||||
events.on('load', this._onLoad.bind(this));
|
store.events.on('close', this._onClose.bind(this));
|
||||||
events.on('close', this._onClose.bind(this));
|
|
||||||
|
|
||||||
if(subscribe)
|
if(subscribe)
|
||||||
this._pubsub.subscribe(dbname, '', this._onMessage.bind(this));
|
this._pubsub.subscribe(dbname, '', this._onMessage.bind(this));
|
||||||
|
|
||||||
return;
|
return store.use(this.user.username);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_onMessage(dbname, message) {
|
_onMessage(dbname, message) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user