[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:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user