MCPcopy Create free account
hub / github.com/DavidWells/analytics / paramsRemove

Function paramsRemove

packages/analytics-utils/src/paramsRemove.js:10–28  ·  view source on GitHub ↗
(param, callback)

Source from the content-addressed store, hash-verified

8 * @return {PromiseLike<void>}
9 */
10export function paramsRemove(param, callback) {
11 if (!isBrowser) return Promise.resolve()
12
13 return new Promise((resolve, reject) => {
14 if (window.history && window.history.replaceState) {
15 const url = window.location.href
16 const cleanUrl = paramsClean(url, param)
17 if (url !== cleanUrl) {
18 /* replace URL with history API */
19 // eslint-disable-next-line no-restricted-globals
20 history.replaceState({}, '', cleanUrl)
21 }
22 }
23
24 if (callback) callback()
25
26 return resolve()
27 })
28}

Callers

nothing calls this directly

Calls 2

paramsCleanFunction · 0.90
resolveFunction · 0.85

Tested by

no test coverage detected