From 92b1d30409c71cb7520fc06e3727701aae02b0a9 Mon Sep 17 00:00:00 2001 From: "Felix W. Dekker" Date: Sat, 4 Jan 2020 00:10:38 +0100 Subject: [PATCH] Use static methods instead of properties Fixes #6. --- index.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 015397f..c030ca6 100644 --- a/index.html +++ b/index.html @@ -128,12 +128,18 @@ } class Base64NumeralSystemInput extends NumeralSystemInput { - static defaultAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - static dropdownOptions = {"Standard": ['+', '/'], "Filename": ['-', '_'], "IMAP": ['+', ',']}; + // TODO Convert static methods to static properties once supported by Firefox + static defaultAlphabet() { + return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + } + + static dropdownOptions() { + return {"Standard": ['+', '/'], "Filename": ['-', '_'], "IMAP": ['+', ',']}; + } constructor(name) { - super(name, new NumeralSystem(64, Base64NumeralSystemInput.defaultAlphabet, true)); + super(name, new NumeralSystem(64, Base64NumeralSystemInput.defaultAlphabet(), true)); this.dropdownLabel = document.createElement("label"); this.dropdownLabel.setAttribute("for", `${this.name}Dropdown`); @@ -143,7 +149,7 @@ this.dropdown = document.createElement("select"); this.dropdown.id = `${this.name}Dropdown`; this.dropdown.onchange = () => { - const selectedOption = Base64NumeralSystemInput.dropdownOptions[this.dropdown.value]; + const selectedOption = Base64NumeralSystemInput.dropdownOptions()[this.dropdown.value]; this.setLastDigits(selectedOption[0], selectedOption[1]); };