From fc87c009806dcc98867f6b58efe29b042aa01dee Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Mon, 18 May 2026 23:10:59 +0800 Subject: node: update --- node_modules/swup/src/helpers/history.ts | 37 -------------------------------- 1 file changed, 37 deletions(-) delete mode 100755 node_modules/swup/src/helpers/history.ts (limited to 'node_modules/swup/src/helpers/history.ts') diff --git a/node_modules/swup/src/helpers/history.ts b/node_modules/swup/src/helpers/history.ts deleted file mode 100755 index e7ea2f6c..00000000 --- a/node_modules/swup/src/helpers/history.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { getCurrentUrl } from './getCurrentUrl.js'; - -export interface HistoryState { - url: string; - source: 'swup'; - random: number; - index?: number; - [key: string]: unknown; -} - -type HistoryData = Record; - -/** Create a new history record with a custom swup identifier. */ -export const createHistoryRecord = (url: string, data: HistoryData = {}): void => { - url = url || getCurrentUrl({ hash: true }); - const state: HistoryState = { - url, - random: Math.random(), - source: 'swup', - ...data - }; - window.history.pushState(state, '', url); -}; - -/** Update the current history record with a custom swup identifier. */ -export const updateHistoryRecord = (url: string | null = null, data: HistoryData = {}): void => { - url = url || getCurrentUrl({ hash: true }); - const currentState = (window.history.state as HistoryState) || {}; - const state: HistoryState = { - ...currentState, - url, - random: Math.random(), - source: 'swup', - ...data - }; - window.history.replaceState(state, '', url); -}; -- cgit v1.2.3