src/store/indexeddb-local-backend.js
async function(roomId, membershipEvents) {
        console.log(`LL: backend about to store ${membershipEvents.length}` +
            ` members for ${roomId}`);
        const tx = this.db.transaction(["oob_membership_events"], "readwrite");
        const store = tx.objectStore("oob_membership_events");
        membershipEvents.forEach((e) => {
            store.put(e);
        });
        // aside from all the events, we also write a marker object to the store
        // to mark the fact that OOB members have been written for this room.
        // It's possible that 0 members need to be written as all where previously know
        // but we still need to know whether to return null or [] from getOutOfBandMembers
        // where null means out of band members haven't been stored yet for this room
        const markerObject = {
            room_id: roomId,
            oob_written: true,
            state_key: 0,
        };
        store.put(markerObject);
        await txnAsPromise(tx);
        console.log(`LL: backend done storing for ${roomId}!`);
    }
async function(roomId, membershipEvents) {
        console.log(`LL: backend about to store ${membershipEvents.length}` +
            ` members for ${roomId}`);
        const tx = this.db.transaction(["oob_membership_events"], "readwrite");
        const store = tx.objectStore("oob_membership_events");
        membershipEvents.forEach((e) => {
            store.put(e);
        });
        // aside from all the events, we also write a marker object to the store
        // to mark the fact that OOB members have been written for this room.
        // It's possible that 0 members need to be written as all where previously know
        // but we still need to know whether to return null or [] from getOutOfBandMembers
        // where null means out of band members haven't been stored yet for this room
        const markerObject = {
            room_id: roomId,
            oob_written: true,
            state_key: 0,
        };
        store.put(markerObject);
        await txnAsPromise(tx);
        console.log(`LL: backend done storing for ${roomId}!`);
    }
async function ( roomId , membershipEvents ) { console . log ( ` ${ membershipEvents . length } ` + ` ${ roomId } ` ) ; const tx = this . db . transaction ( [ "oob_membership_events" ] , "readwrite" ) ; const store = tx . objectStore ( "oob_membership_events" ) ; membershipEvents . forEach ( ( e ) => { store . put ( e ) ; } ) ; // aside from all the events, we also write a marker object to the store // to mark the fact that OOB members have been written for this room. // It's possible that 0 members need to be written as all where previously know // but we still need to know whether to return null or [] from getOutOfBandMembers // where null means out of band members haven't been stored yet for this room const markerObject = { room_id : roomId , oob_written : true , state_key : 0 , } ; store . put ( markerObject ) ; await txnAsPromise ( tx ) ; console . log ( ` ${ roomId } ` ) ; }
Stores the out-of-band membership events for this room. Note that
it still makes sense to store an empty array as the OOB status for the room is
marked as fetched, and getOutOfBandMembers will return an empty array instead of null
@param {string} roomId
@param {event[]} membershipEvents the membership events to store
Stores the out - of - band membership events for this room . Note that it still makes sense to store an empty array as the OOB status for the room is marked as fetched and getOutOfBandMembers will return an empty array instead of null