UNPKG

quasar

Version:

Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time

32 lines (24 loc) 633 B
import { onBeforeUnmount } from 'vue' import History from '../../plugins/private.history/History.js' export default function useHistory(showing, hide, hideOnRouteChange) { let historyEntry function removeFromHistory() { if (historyEntry !== void 0) { History.remove(historyEntry) historyEntry = void 0 } } onBeforeUnmount(() => { if (showing.value === true) removeFromHistory() }) return { removeFromHistory, addToHistory() { historyEntry = { condition: () => hideOnRouteChange.value === true, handler: hide } History.add(historyEntry) } } }