UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

2 lines (1 loc) 937 B
import{DEBUG_KEY as i,SET_KIOSK_KEY as a}from"../constants";import n from"../data";import s,{uiState as l}from"../store";import{handleDebugMode as c}from"../tools/handleDebugMode";import{getRebookingTokenFromQuery as m}from"../tools/rebookingUrl";export function handleCustomCommand(o){if(o=o.trim(),o.toLowerCase()==="__addcache")navigator.serviceWorker.getRegistrations().then(r=>{if(!r.length)return alert("No registered service workers.");var t=[];s.exhibitorStore.exhibitors.forEach(e=>{t.push(e.logo),t.push(...e.gallery||[])}),Promise.all(t.map(e=>fetch(e))).then(e=>alert(`${e.length} images loaded.`)).catch(e=>alert(e))});else if(/^copy_exh=\d+/.test(o)){const r=o.match(/^copy_exh=(\d+)/);if(r&&!isNaN(parseInt(r[1]))){const e=`${window.location.origin+window.location.pathname}?${r[0]}`;window.location.replace(e)}}else{if(m())return!0;o.startsWith(i)?c():o===(n.flags?.customSetKiosk||a)&&l.enableSetKioskMode(!0)}return!1}