Browse Source

Use static methods instead of properties

Fixes #6.
master
F.W. Dekker 2 years ago
parent
commit
92b1d30409
Signed by: FWDekker GPG Key ID: B1B567AF58D6EE0F
  1. 14
      index.html

14
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]);
};

Loading…
Cancel
Save