[refactor] Moved 'clearSelector' to its own TS file.

This commit is contained in:
Steven Evans 2018-07-09 13:57:21 -04:00
parent 9e26ee7858
commit af40252ee9
3 changed files with 12 additions and 9 deletions

@ -7,7 +7,7 @@ import {Player} from "./Player";
import Decimal from "decimal.js"; import Decimal from "decimal.js";
import {dialogBoxCreate} from "../utils/DialogBox"; import {dialogBoxCreate} from "../utils/DialogBox";
import {clearSelector} from "../utils/HelperFunctions"; import {clearSelector} from "../utils/uiHelpers/clearSelector";
import {Reviver, Generic_toJSON, import {Reviver, Generic_toJSON,
Generic_fromJSON} from "../utils/JSONReviver"; Generic_fromJSON} from "../utils/JSONReviver";
import numeral from "numeral/min/numeral.min"; import numeral from "numeral/min/numeral.min";
@ -4924,3 +4924,4 @@ Corporation.fromJSON = function(value) {
Reviver.constructors.Corporation = Corporation; Reviver.constructors.Corporation = Corporation;
export {Corporation}; export {Corporation};

@ -27,11 +27,4 @@ function createAccordionElement(params) {
return [li, hdr, panel]; return [li, hdr, panel];
} }
function clearSelector(selector) { export {createAccordionElement};
for (var i = selector.options.length - 1; i >= 0; --i) {
selector.remove(i);
}
}
export {createAccordionElement,
clearSelector};

@ -0,0 +1,9 @@
/**
* Clears all <option> elements from a <select>.
* @param selector The <select> element
*/
export function clearSelector(selector: HTMLSelectElement) {
for (let i: number = selector.options.length - 1; i >= 0; i--) {
selector.remove(i);
}
}