FlutterWindowClosePluginWeb constructor
FlutterWindowClosePluginWeb()
Implementation
FlutterWindowClosePluginWeb() {
window.addEventListener(
'beforeunload',
(JSAny event) {
if (event.isA<BeforeUnloadEvent>()) {
final unloadEvent = event as BeforeUnloadEvent;
unloadEvent.preventDefault();
if (_returnValue != null) {
unloadEvent.returnValue = _returnValue!;
}
}
}.toJS,
);
}