@@ -9,18 +9,18 @@ import {
99const table = document . querySelector ( '.table' ) ! ;
1010
1111/**
12- *
12+ * (Re)Builds the list of diasabled hostnames
1313 */
14- function buildEntries ( ) {
14+ function buildEntries ( ) : void {
1515 table . innerHTML = '' ;
1616 disabledHosts . forEach ( createEntry ) ;
1717}
1818
1919/**
20- *
21- * @returns
20+ * Async function to add a hostname (from the form / URL Search Params) to the displayed list and the storage list of disabled hosts
21+ * If the entry is already present in the stored hosts, no entry is added to the display list
2222 */
23- async function addEntry ( ) {
23+ async function addEntry ( ) : Promise < void > {
2424 const search = new URLSearchParams ( document . location . search ) ;
2525 let hostname = search . get ( 'hostname' ) ;
2626 if ( hostname === null ) return ;
@@ -33,10 +33,10 @@ async function addEntry() {
3333}
3434
3535/**
36- *
37- * @param hostname
36+ * Creates a new entry for the displayed list of disabled hostnames and appends it to the view
37+ * @param hostname Hostname to add to the list
3838 */
39- function createEntry ( hostname : string ) {
39+ function createEntry ( hostname : string ) : void {
4040 const div = document . createElement ( 'div' ) ;
4141
4242 let span = document . createElement ( 'span' ) ;
@@ -50,11 +50,11 @@ function createEntry(hostname: string) {
5050}
5151
5252/**
53- *
54- * @param click
55- * @returns
53+ * Async funtion to remove an entry at click of its button.
54+ * Takes the index in the table to remove it from the list of stored hostnames
55+ * @param click Button click
5656 */
57- async function removeEntry ( click : MouseEvent ) {
57+ async function removeEntry ( click : MouseEvent ) : Promise < void > {
5858 let target : EventTarget | null = click . target ;
5959 if ( target === null ) return ;
6060
@@ -65,11 +65,11 @@ async function removeEntry(click: MouseEvent) {
6565}
6666
6767/**
68- *
69- * @param button
70- * @returns
68+ * Gets the index of a list entry using its clicked button
69+ * @param button Button that was clicked to remove an entry
70+ * @returns Index of the list entry
7171 */
72- function getIndex ( button : HTMLButtonElement ) {
72+ function getIndex ( button : HTMLButtonElement ) : number {
7373 let div : HTMLDivElement = button . parentElement as HTMLDivElement ;
7474 if ( div === null ) return - 1 ;
7575
0 commit comments