From a544c25d58342d2c8ba69bafce5a0c5acb2ad286 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Sun, 10 Feb 2019 22:02:42 +0100 Subject: [PATCH] more --- README.md | 6 +++- doc/TODO.md | 29 ++++++++++++++----- src/matrix/room/persister.js | 1 - src/matrix/session.js | 1 + .../storage/idb/stores/RoomTimelineStore.js | 12 +++----- 5 files changed, 31 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 5dc17409..6293760b 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,8 @@ A javascript matrix client prototype, trying to minize RAM usage by offloading a ## Status -Not working yet +Sort of syncing, but not really yet. + +## Troubleshooting + +You need to disable the browser cache to see your updated code when refreshing \ No newline at end of file diff --git a/doc/TODO.md b/doc/TODO.md index 732f8ab9..b0b09bf2 100644 --- a/doc/TODO.md +++ b/doc/TODO.md @@ -1,11 +1,24 @@ # Minimal thing to get working - - finish summary store - - move "sdk" bits over to "matrix" directory - - add eventemitter - - make sync work - - store summaries + - DONE: finish summary store + - DONE: move "sdk" bits over to "matrix" directory + - DONE: add eventemitter + - DONE: make sync work + - DONE: store summaries - setup editorconfig - - setup linting (also in editor) - - store timeline - - store state \ No newline at end of file + - DONE: setup linting (also in editor) + - DONE: store timeline + - DONE: store state + - make summary work better (name and joined/inviteCount doesn't seem to work well) + - timeline doesn't seem to recover it's key well upon loading, the query in load seems to never yield an event in the persister + - map DOMException to something better + - it's pretty opaque now when something idb related fails. DOMException has these fields: + code: 0 + message: "Key already exists in the object store." + name: "ConstraintError" + - emit events so we can start showing something on the screen maybe? + - move session._rooms over to Map, so we can iterate over it, ... + - build a very basic interface with + - a start/stop sync button + - a room list sorted alphabetically + - clicking on a room list, you see messages (userId -> body) \ No newline at end of file diff --git a/src/matrix/room/persister.js b/src/matrix/room/persister.js index 67bcfbf6..e97b451e 100644 --- a/src/matrix/room/persister.js +++ b/src/matrix/room/persister.js @@ -4,7 +4,6 @@ export default class RoomPersister { constructor(roomId) { this._roomId = roomId; this._lastSortKey = new SortKey(); - } async load(txn) { diff --git a/src/matrix/session.js b/src/matrix/session.js index da86b195..ee313062 100644 --- a/src/matrix/session.js +++ b/src/matrix/session.js @@ -4,6 +4,7 @@ export default class Session { constructor(storage) { this._storage = storage; this._session = null; + // use Map here? this._rooms = {}; } // should be called before load diff --git a/src/matrix/storage/idb/stores/RoomTimelineStore.js b/src/matrix/storage/idb/stores/RoomTimelineStore.js index df729277..084b2230 100644 --- a/src/matrix/storage/idb/stores/RoomTimelineStore.js +++ b/src/matrix/storage/idb/stores/RoomTimelineStore.js @@ -37,10 +37,8 @@ export default class RoomTimelineStore { this._timelineStore.add({ roomId: roomId, sortKey: sortKey.buffer, - content: { - event: null, - gap: gap, - }, + event: null, + gap: gap, }); } @@ -49,10 +47,8 @@ export default class RoomTimelineStore { this._timelineStore.add({ roomId: roomId, sortKey: sortKey.buffer, - content: { - event: event, - gap: null, - }, + event: event, + gap: null, }); }