[Dart] Cleaner code, force the web page to reload on modifier code

The code in `navbar.dart' is now more declarative and cleaner.

If the `lastUpdate' variable’s content change, then it will force the
user to reload the page, bypassing their cache. This can be useful in
case of an update with which the cache could break the website.
This commit is contained in:
2020-08-28 22:23:35 +02:00
parent e710c594f1
commit 16f23c08c6
2 changed files with 13 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
import 'dart:html' show DivElement, Element, querySelector, querySelectorAll;
import 'dart:html'
show DivElement, Element, querySelector, querySelectorAll, window;
import './navbar.dart' show makeNavbar;
@@ -40,6 +41,13 @@ Future<void> linkifyImg() async {
}
Future<void> reorganizeHtml() async {
final ls = window.localStorage;
final lastUpdate = '20200828';
if (ls['last-update'] != lastUpdate) {
ls['last-update'] = lastUpdate;
window.location.reload();
}
// Make navbar
final navbar = await makeNavbar();