Skip to content

Commit ac6efd2

Browse files
committed
Add Devserver reload
1 parent cf6309d commit ac6efd2

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

devserver/devserver_loader.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ setInterval(() => {
66
return response.json();
77
})
88
.then(function (manifest) {
9-
console.warn(manifest);
9+
if (!window.__DEVSERVER_MANIFEST__) {
10+
__DEVSERVER_MANIFEST__ = manifest;
11+
return;
12+
}
13+
14+
for (let key in manifest) {
15+
if (manifest[key] !== __DEVSERVER_MANIFEST__[key]) {
16+
console.log("Reloading due to change in " + key);
17+
window.location.reload();
18+
}
19+
}
1020
})
1121
}, 1000);

devserver/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ json ComputeManifest(const std::map<Path, FileContents> &path_to_contents) {
116116
char digest[PICOHASH_MD5_DIGEST_LENGTH];
117117

118118
picohash_init_md5(&ctx);
119-
picohash_update(&ctx, &contents, contents.size());
119+
picohash_update(&ctx, contents.c_str(), contents.size());
120120
picohash_final(&ctx, digest);
121121
std::string digest_str(base64_encode(digest, PICOHASH_MD5_DIGEST_LENGTH));
122122
manifest[path] = digest_str;

0 commit comments

Comments
 (0)