Unverified Commit 4728ef5c authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

handle browser refresh (#39776)

parent 06348522
...@@ -90,6 +90,7 @@ class WebFs { ...@@ -90,6 +90,7 @@ class WebFs {
final Dwds _dwds; final Dwds _dwds;
final Chrome _chrome; final Chrome _chrome;
final BuildDaemonClient _client; final BuildDaemonClient _client;
StreamSubscription<void> _connectedApps;
static const String _kHostName = 'localhost'; static const String _kHostName = 'localhost';
...@@ -98,13 +99,20 @@ class WebFs { ...@@ -98,13 +99,20 @@ class WebFs {
await _dwds.stop(); await _dwds.stop();
await _server.close(force: true); await _server.close(force: true);
await _chrome.close(); await _chrome.close();
await _connectedApps?.cancel();
} }
/// Retrieve the [DebugConnection] for the current application. /// Retrieve the [DebugConnection] for the current application.
Future<DebugConnection> runAndDebug() async { Future<DebugConnection> runAndDebug() async {
final AppConnection appConnection = await _dwds.connectedApps.first; final Completer<DebugConnection> firstConnection = Completer<DebugConnection>();
appConnection.runMain(); _connectedApps = _dwds.connectedApps.listen((AppConnection appConnection) async {
return _dwds.debugConnection(appConnection); appConnection.runMain();
final DebugConnection debugConnection = await _dwds.debugConnection(appConnection);
if (!firstConnection.isCompleted) {
firstConnection.complete(debugConnection);
}
});
return firstConnection.future;
} }
/// Perform a hard refresh of all connected browser tabs. /// Perform a hard refresh of all connected browser tabs.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment