Reduce condition complexity

This commit is contained in:
Marwin Hochfelsner 2025-02-08 11:43:54 +01:00
parent e206dd527e
commit a3c45f6ed6
6 changed files with 31 additions and 64 deletions

View file

@ -142,11 +142,8 @@ OSM.Router = function (map, rts) {
};
router.stateChange = function (state) {
if (state.center) {
window.history.replaceState(state, document.title, OSM.formatHash(state));
} else {
window.history.replaceState(state, document.title, window.location);
}
const url = state.center ? OSM.formatHash(state) : window.location;
window.history.replaceState(state, document.title, url);
};
router.updateHash = function () {