mirror of https://github.com/AMT-Cheif/drift.git
20 lines
540 B
Dart
20 lines
540 B
Dart
import 'dart:html';
|
|
|
|
import 'package:drift/drift.dart';
|
|
import 'package:drift/web.dart';
|
|
import 'package:drift/remote.dart';
|
|
|
|
void main() {
|
|
final self = SharedWorkerGlobalScope.instance;
|
|
self.importScripts('sql-wasm.js');
|
|
|
|
final db = WebDatabase.withStorage(DriftWebStorage.indexedDb('worker',
|
|
migrateFromLocalStorage: false, inWebWorker: true));
|
|
final server = DriftServer(DatabaseConnection(db));
|
|
|
|
self.onConnect.listen((event) {
|
|
final msg = event as MessageEvent;
|
|
server.serve(msg.ports.first.channel());
|
|
});
|
|
}
|