drift/examples/app/web/worker.dart

17 lines
434 B
Dart
Raw Normal View History

2022-04-02 09:01:10 -07:00
// ignore: avoid_web_libraries_in_flutter
import 'dart:html';
import 'package:app/database/connection/web.dart';
import 'package:drift/web.dart';
import 'package:drift/remote.dart';
void main() {
final self = SharedWorkerGlobalScope.instance;
final server = DriftServer(connect(isInWebWorker: true));
self.onConnect.listen((event) {
final msg = event as MessageEvent;
server.serve(msg.ports.first.channel());
});
}