mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 21:25:47 +01:00
[refactor] Moved 'clearSelector' to its own TS file.
This commit is contained in:
parent
9e26ee7858
commit
af40252ee9
@ -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};
|
||||
|
||||
|
@ -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};
|
||||
|
9
utils/uiHelpers/clearSelector.ts
Normal file
9
utils/uiHelpers/clearSelector.ts
Normal file
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user