Skip to content

Commit 8f8ad12

Browse files
srujzsCommit Queue
authored andcommitted
[DDC] Allow deferring of hotReloadEnd via callback
This allows the application to set breakpoints in the new scripts before pushing them into the Dart runtime. Change-Id: Ica4613e061bf7db05b3e17366d3f3a4e0e46685d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429422 Commit-Queue: Nicholas Shahan <[email protected]> Auto-Submit: Srujan Gaddam <[email protected]> Reviewed-by: Nicholas Shahan <[email protected]>
1 parent 823908a commit 8f8ad12

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

pkg/dev_compiler/lib/js/ddc/ddc_module_loader.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,14 @@ if (!self.deferred_loader) {
16181618
);
16191619
}
16201620
await Promise.all(reloadFilePromises).then((_) => {
1621-
this.hotReloadEnd();
1621+
if (dartDevEmbedderConfig.captureHotReloadEndHandler != null) {
1622+
// Let the app decide when to update the libraries.
1623+
dartDevEmbedderConfig.captureHotReloadEndHandler(() => {
1624+
this.hotReloadEnd();
1625+
});
1626+
} else {
1627+
this.hotReloadEnd();
1628+
}
16221629
});
16231630
}
16241631

@@ -2053,6 +2060,16 @@ if (!self.deferred_loader) {
20532060
* @type {?function()}
20542061
*/
20552062
mainErrorCallback = null;
2063+
2064+
/*
2065+
* An optional handler that acts as a wrapper around the push of the hot
2066+
* reloaded libraries into the Dart runtime which completes the hot reload.
2067+
* Passed an opaque function as an argument that pushes the libraries that
2068+
* were previously loaded into the page during a call to
2069+
* `DartDevEmbedder.hotReload` when called.
2070+
* @type {?function(function())}
2071+
*/
2072+
captureHotReloadEndHandler = null;
20562073
}
20572074

20582075
const dartDevEmbedderConfig = new DartDevEmbedderConfiguration();

0 commit comments

Comments
 (0)