MCPcopy Create free account
hub / github.com/ampproject/amphtml / getLocationHashParams

Function getLocationHashParams

validator/js/webui/webui.js:4–15  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3// Extracts a dictionary of parameters from window.location.hash.
4function getLocationHashParams() {
5 const paramStrings = window.location.hash.substr(1).split('&');
6 const params = {};
7 for (let ii = 0; ii < paramStrings.length; ii++) {
8 const keyValue = paramStrings[ii].split('=');
9 if (keyValue[0].length > 0) {
10 params[keyValue[0]] = keyValue[1]
11 ? decodeURIComponent(keyValue[1]) : undefined;
12 }
13 }
14 return params;
15}
16
17// Removes given parameter from window.location.hash.
18function removeParamFromLocationHashParams(param) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected