* @param {!Window} win * @param {!{[key: string]: string}|undefined} initParams * @return {!{[key: string]: string}}
(win, initParams)
| 1070 | * @return {!{[key: string]: string}} |
| 1071 | */ |
| 1072 | function extractSingleDocParams(win, initParams) { |
| 1073 | const params = map(); |
| 1074 | if (initParams) { |
| 1075 | // The initialization params take the highest precedence. |
| 1076 | Object.assign(params, initParams); |
| 1077 | } else { |
| 1078 | // Params can be passed via iframe hash/name with hash taking precedence. |
| 1079 | if (win.name && win.name.indexOf(PARAMS_SENTINEL) == 0) { |
| 1080 | Object.assign( |
| 1081 | params, |
| 1082 | parseQueryString(win.name.substring(PARAMS_SENTINEL.length)) |
| 1083 | ); |
| 1084 | } |
| 1085 | if (win.location && win.location.hash) { |
| 1086 | Object.assign(params, parseQueryString(win.location.hash)); |
| 1087 | } |
| 1088 | } |
| 1089 | return params; |
| 1090 | } |
| 1091 | |
| 1092 | /** |
| 1093 | * Install the ampdoc service and immediately configure it for either a |
no test coverage detected