forked from mystiq/hydrogen-web
WIP2
This commit is contained in:
parent
abffdf1877
commit
c05e40188b
2 changed files with 10 additions and 5 deletions
11
doc/TODO.md
11
doc/TODO.md
|
@ -1,5 +1,10 @@
|
||||||
# Minimal thing to get working
|
# Minimal thing to get working
|
||||||
|
|
||||||
- given an access token, a working sync loop that echoes all the messages
|
- finish summary store
|
||||||
- allow sync to resume from storage
|
- add eventemitter
|
||||||
-
|
- make sync work
|
||||||
|
- store summaries
|
||||||
|
- setup editorconfig
|
||||||
|
- setup linting (also in editor)
|
||||||
|
- store timeline
|
||||||
|
- store state
|
|
@ -1,11 +1,11 @@
|
||||||
export default class Session {
|
export default class Session {
|
||||||
// loginData has device_id, user_id, home_server, access_token
|
|
||||||
constructor(storage) {
|
constructor(storage) {
|
||||||
this._storage = storage;
|
this._storage = storage;
|
||||||
this._session = null;
|
this._session = null;
|
||||||
this._rooms = null;
|
this._rooms = null;
|
||||||
}
|
}
|
||||||
// should be called before load
|
// should be called before load
|
||||||
|
// loginData has device_id, user_id, home_server, access_token
|
||||||
async setLoginData(loginData) {
|
async setLoginData(loginData) {
|
||||||
const txn = this._storage.readWriteTxn([this._storage.storeNames.session]);
|
const txn = this._storage.readWriteTxn([this._storage.storeNames.session]);
|
||||||
const session = {loginData};
|
const session = {loginData};
|
||||||
|
@ -43,7 +43,7 @@ export default class Session {
|
||||||
|
|
||||||
applySync(syncToken, accountData, txn) {
|
applySync(syncToken, accountData, txn) {
|
||||||
this._session.syncToken = syncToken;
|
this._session.syncToken = syncToken;
|
||||||
txn.session.setSession(this._session);
|
txn.session.set(this._session);
|
||||||
}
|
}
|
||||||
|
|
||||||
get syncToken() {
|
get syncToken() {
|
||||||
|
|
Loading…
Reference in a new issue