2021-06-18 10:29:48 +02:00
|
|
|
import 'package:matrix/matrix.dart';
|
2020-05-13 15:58:59 +02:00
|
|
|
import 'package:moor/moor_web.dart';
|
|
|
|
import 'dart:html';
|
|
|
|
|
2020-07-20 17:33:52 +02:00
|
|
|
Future<Database> constructDb(
|
2020-05-22 12:21:16 +02:00
|
|
|
{bool logStatements = false,
|
|
|
|
String filename = 'database.sqlite',
|
2020-07-20 17:33:52 +02:00
|
|
|
String password = ''}) async {
|
2020-12-19 13:06:31 +01:00
|
|
|
Logs().v('[Moor] Using moor web');
|
2020-05-22 12:21:16 +02:00
|
|
|
return Database(WebDatabase.withStorage(
|
2021-04-21 14:19:54 +02:00
|
|
|
await MoorWebStorage.indexedDbIfSupported(filename),
|
2020-05-22 12:21:16 +02:00
|
|
|
logStatements: logStatements));
|
2020-05-13 15:58:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Future<String> getLocalstorage(String key) async {
|
2021-03-04 12:28:06 +01:00
|
|
|
return window.localStorage[key];
|
2020-05-13 15:58:59 +02:00
|
|
|
}
|