aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.html
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-01-05 14:34:36 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-01-05 14:34:36 +0100
commitf9cb20ffcbb1294e31c3a14e5535d4f12274b13c (patch)
tree8ab6805d24ee8100032dd82790f3468021c0c537 /src/index.html
parentMerge pull request #517 from dannyqiu/service-cache-cleanup (diff)
downloadferdium-app-f9cb20ffcbb1294e31c3a14e5535d4f12274b13c.tar.gz
ferdium-app-f9cb20ffcbb1294e31c3a14e5535d4f12274b13c.tar.zst
ferdium-app-f9cb20ffcbb1294e31c3a14e5535d4f12274b13c.zip
Improve annoying livereload reload behaviour for main/webview processes
Diffstat (limited to 'src/index.html')
-rw-r--r--src/index.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/index.html b/src/index.html
index 05a93e37b..9e5acd705 100644
--- a/src/index.html
+++ b/src/index.html
@@ -23,6 +23,24 @@
23 s.async = true; 23 s.async = true;
24 s.setAttribute('src', lrHost + '/livereload.js'); 24 s.setAttribute('src', lrHost + '/livereload.js');
25 document.body.appendChild(s); 25 document.body.appendChild(s);
26
27 s.onload = () => {
28 console.log('livereload loaded');
29 const originalReloadBehaviour = window._onLiveReloadFileChanged;
30
31 window._onLiveReloadFileChanged = (file) => {
32 if (!file.path.includes('/build/webview/') && !file.path.includes('/build/index.js') && !file.path.includes('/build/electron/')) {
33 originalReloadBehaviour(file);
34 } else {
35 if (file.path.includes('/build/webview/')) {
36 console.log('Livereload: Reloading all webvies');
37 const webviews = document.querySelectorAll('webview').forEach(webview => webview.reload());
38 } else {
39 console.log('Livereload: skip reload as only main process files have changed');
40 }
41 }
42 }
43 }
26 })(); 44 })();
27 } 45 }
28 </script> 46 </script>