(name: string)
| 13 | } |
| 14 | |
| 15 | export function getStringParameter(name: string) { |
| 16 | const els = document.querySelectorAll(`input[name="${name}"]`); |
| 17 | let value: any; |
| 18 | let el: any; |
| 19 | |
| 20 | for (let i = 0; i < els.length; i++) { |
| 21 | el = els[i]; |
| 22 | const type = el.type; |
| 23 | if ((type != 'radio' && type != 'checkbox') || el.checked) { |
| 24 | value = el.value; |
| 25 | break; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | if (value == null) { |
| 30 | throw new Error(`Could not find and input field with name ${name}`); |
| 31 | } |
| 32 | |
| 33 | return value; |
| 34 | } |
| 35 | |
| 36 | export function bindAction(selector: string, callback: () => void) { |
| 37 | document.querySelector(selector)!.addEventListener('click', callback); |
no outgoing calls
no test coverage detected
searching dependent graphs…