Hot Loading Indicators

Summary:
public

Introduce a header bar similar to the one shown when loading the bundle to indicate that the packager server is processing an HMR update. Hook into HMR events to show this bar when appropriate.

Reviewed By: javache

Differential Revision: D2873521

fb-gh-sync-id: a77cbb2368b75b045aa8c6ababce2f731baf514b
This commit is contained in:
Martín Bigio
2016-02-01 12:41:04 -08:00
committed by facebook-github-bot-7
parent 180ead05e9
commit 36efbc341d
3 changed files with 77 additions and 44 deletions

View File

@@ -112,6 +112,7 @@ function attachHMRServer({httpServer, path, packagerServer}) {
return;
}
client.ws.send(JSON.stringify({type: 'update-start'}));
stat.then(() => {
return packagerServer.getShallowDependencies(filename)
.then(deps => {
@@ -240,7 +241,9 @@ function attachHMRServer({httpServer, path, packagerServer}) {
() => {
// do nothing, file was removed
},
);
).finally(() => {
client.ws.send(JSON.stringify({type: 'update-done'}));
});
});
client.ws.on('error', e => {