mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Move Knoin routOff, routOn, routReload & setHash to rl.route.*
This commit is contained in:
parent
03a40f3249
commit
467f615713
17 changed files with 83 additions and 111 deletions
|
|
@ -2,8 +2,6 @@ import ko from 'ko';
|
|||
|
||||
import { $htmlCL, VIEW_MODELS } from 'Common/Globals';
|
||||
|
||||
import { root } from 'Common/Links';
|
||||
|
||||
//import { bMobileDevice } from 'Common/Globals';
|
||||
|
||||
let currentScreen = null,
|
||||
|
|
@ -82,30 +80,6 @@ export function addSettingsViewModel(SettingsViewModelClass, template, labelName
|
|||
VIEW_MODELS.settings.push(SettingsViewModelClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function routeReload() {
|
||||
routeOff();
|
||||
setHash(root(), true);
|
||||
routeOff();
|
||||
setTimeout(() => (rl.settings.app('inIframe') ? parent : window).location.reload(), 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function routeOff() {
|
||||
hasher.changed.active = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function routeOn() {
|
||||
hasher.changed.active = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} screenName
|
||||
* @returns {?Object}
|
||||
|
|
@ -422,28 +396,6 @@ export function startScreens(screensClasses) {
|
|||
setTimeout(() => $htmlCL.add('rl-started-delay'), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} sHash
|
||||
* @param {boolean=} silence = false
|
||||
* @param {boolean=} replace = false
|
||||
* @returns {void}
|
||||
*/
|
||||
export function setHash(hash, silence = false, replace = false) {
|
||||
hash = hash.replace(/^[#/]+/, '');
|
||||
|
||||
const cmd = replace ? 'replaceHash' : 'setHash';
|
||||
|
||||
if (silence) {
|
||||
hasher.changed.active = false;
|
||||
hasher[cmd](hash);
|
||||
hasher.changed.active = true;
|
||||
} else {
|
||||
hasher.changed.active = true;
|
||||
hasher[cmd](hash);
|
||||
hasher.setHash(hash);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} params
|
||||
* @returns {Function}
|
||||
|
|
@ -524,7 +476,7 @@ function settingsMenuKeysHandler(items) {
|
|||
}
|
||||
|
||||
const resultHash = items[index].href;
|
||||
resultHash && setHash(resultHash, false, true);
|
||||
resultHash && rl.route.setHash(resultHash, false, true);
|
||||
}
|
||||
}).throttle(200);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue