From af40252ee9dcc8a729b673f1f076fa62b5a75797 Mon Sep 17 00:00:00 2001 From: Steven Evans Date: Mon, 9 Jul 2018 13:57:21 -0400 Subject: [PATCH] [refactor] Moved 'clearSelector' to its own TS file. --- src/CompanyManagement.js | 3 ++- utils/HelperFunctions.js | 9 +-------- utils/uiHelpers/clearSelector.ts | 9 +++++++++ 3 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 utils/uiHelpers/clearSelector.ts diff --git a/src/CompanyManagement.js b/src/CompanyManagement.js index ba818dacf..68eee692b 100644 --- a/src/CompanyManagement.js +++ b/src/CompanyManagement.js @@ -7,7 +7,7 @@ import {Player} from "./Player"; import Decimal from "decimal.js"; import {dialogBoxCreate} from "../utils/DialogBox"; -import {clearSelector} from "../utils/HelperFunctions"; +import {clearSelector} from "../utils/uiHelpers/clearSelector"; import {Reviver, Generic_toJSON, Generic_fromJSON} from "../utils/JSONReviver"; import numeral from "numeral/min/numeral.min"; @@ -4924,3 +4924,4 @@ Corporation.fromJSON = function(value) { Reviver.constructors.Corporation = Corporation; export {Corporation}; + diff --git a/utils/HelperFunctions.js b/utils/HelperFunctions.js index b76317be7..69f4e8891 100644 --- a/utils/HelperFunctions.js +++ b/utils/HelperFunctions.js @@ -27,11 +27,4 @@ function createAccordionElement(params) { return [li, hdr, panel]; } -function clearSelector(selector) { - for (var i = selector.options.length - 1; i >= 0; --i) { - selector.remove(i); - } -} - -export {createAccordionElement, - clearSelector}; +export {createAccordionElement}; diff --git a/utils/uiHelpers/clearSelector.ts b/utils/uiHelpers/clearSelector.ts new file mode 100644 index 000000000..39e087bc0 --- /dev/null +++ b/utils/uiHelpers/clearSelector.ts @@ -0,0 +1,9 @@ +/** + * Clears all