(param, callback)
| 8 | * @return {PromiseLike<void>} |
| 9 | */ |
| 10 | export 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 | } |
nothing calls this directly
no test coverage detected