Migrate AccountDataStore.js to TypeScript.
This commit is contained in:
parent
77f75fd968
commit
742ab28099
2 changed files with 19 additions and 10 deletions
|
@ -33,7 +33,7 @@ import {InboundGroupSessionStore} from "./stores/InboundGroupSessionStore.js";
|
||||||
import {OutboundGroupSessionStore} from "./stores/OutboundGroupSessionStore";
|
import {OutboundGroupSessionStore} from "./stores/OutboundGroupSessionStore";
|
||||||
import {GroupSessionDecryptionStore} from "./stores/GroupSessionDecryptionStore";
|
import {GroupSessionDecryptionStore} from "./stores/GroupSessionDecryptionStore";
|
||||||
import {OperationStore} from "./stores/OperationStore";
|
import {OperationStore} from "./stores/OperationStore";
|
||||||
import {AccountDataStore} from "./stores/AccountDataStore.js";
|
import {AccountDataStore} from "./stores/AccountDataStore";
|
||||||
|
|
||||||
export class Transaction {
|
export class Transaction {
|
||||||
constructor(txn, allowedStoreNames, IDBKeyRange) {
|
constructor(txn, allowedStoreNames, IDBKeyRange) {
|
||||||
|
|
|
@ -13,17 +13,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import {Store} from "../Store";
|
||||||
|
import {Content} from "../../types";
|
||||||
|
|
||||||
|
interface AccountDataEntry {
|
||||||
|
type: string;
|
||||||
|
content: Content;
|
||||||
|
}
|
||||||
|
|
||||||
export class AccountDataStore {
|
export class AccountDataStore {
|
||||||
constructor(store) {
|
private _store: Store<AccountDataEntry>;
|
||||||
this._store = store;
|
|
||||||
}
|
|
||||||
|
|
||||||
async get(type) {
|
constructor(store: Store<AccountDataEntry>) {
|
||||||
return await this._store.get(type);
|
this._store = store;
|
||||||
}
|
}
|
||||||
|
|
||||||
set(event) {
|
async get(type: string): Promise<AccountDataEntry | null> {
|
||||||
return this._store.put(event);
|
return await this._store.get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set(event: AccountDataEntry): Promise<IDBValidKey> {
|
||||||
|
return this._store.put(event);
|
||||||
|
}
|
||||||
}
|
}
|
Reference in a new issue