Add initialSyncDone property to storage service
Allows us to know when the first sync cycle has been completed
This commit is contained in:
@@ -12,6 +12,7 @@ export default class StorageService extends Service {
|
|||||||
@tracked loadedPrefixes = [];
|
@tracked loadedPrefixes = [];
|
||||||
@tracked currentBbox = null;
|
@tracked currentBbox = null;
|
||||||
@tracked version = 0; // Shared version tracker for bookmarks
|
@tracked version = 0; // Shared version tracker for bookmarks
|
||||||
|
@tracked initialSyncDone = false;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
@@ -31,10 +32,16 @@ export default class StorageService extends Service {
|
|||||||
// widget.attach();
|
// widget.attach();
|
||||||
|
|
||||||
this.rs.on('ready', () => {
|
this.rs.on('ready', () => {
|
||||||
// this.loadAllPlaces();
|
// console.debug('[rs] client ready');
|
||||||
|
});
|
||||||
|
|
||||||
|
this.rs.on('sync-done', result => {
|
||||||
|
// console.debug('[rs] sync done:', result);
|
||||||
|
if (!this.initialSyncDone) { this.initialSyncDone = true; }
|
||||||
});
|
});
|
||||||
|
|
||||||
this.rs.scope('/places/').on('change', (event) => {
|
this.rs.scope('/places/').on('change', (event) => {
|
||||||
|
console.debug(event);
|
||||||
debounce(this, this.reloadCurrentView, 200);
|
debounce(this, this.reloadCurrentView, 200);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user