/** * NavParams for a MPA-Application */ export class VetproviehNavParams { /** * Get a URL-Parameter * @param {stirng} key * @return {any} */ static getUrlParameter(key: string): any { const regex = new RegExp('[?&]' + encodeURIComponent(key) + '=([^&]*)'); let regexResult : RegExpExecArray | null = null; if (regexResult = regex.exec(window.location.search)) { return decodeURIComponent(regexResult[1]); } else { return null; } } /** * Returning Something out of the Storage * @param {string} key * @return {any} */ static get(key: string): any { const loadedObject = window.localStorage.getItem(key); if (loadedObject) { return JSON.parse(loadedObject); } return {}; } /** * Delete a local Storage Item * @param {string} key */ static delete(key: string) { window.localStorage.removeItem(key); } /** * Setting Storage * @param {string} key * @param {any} value */ static set(key: string, value: any) { window.localStorage.setItem(key, JSON.stringify(value)); } }