canihazusername/demo/main.ts

16 lines
513 B
TypeScript
Raw Normal View History

2023-07-12 23:05:30 +02:00
import { generate, showAvailableLists } from '../src/index'
2020-02-05 21:21:51 +01:00
2020-02-05 22:48:14 +01:00
const input = window.document.getElementById('format') as HTMLInputElement
const output = window.document.getElementById('username') as HTMLInputElement
const list = window.document.getElementById('lists')
const button = window.document.getElementById('button')
2023-07-12 23:05:30 +02:00
function calculate() {
2021-03-15 18:14:19 +01:00
output.value = generate(input.value)
2020-02-05 22:48:14 +01:00
}
2020-02-06 17:09:21 +01:00
// Init
2023-07-12 23:05:30 +02:00
button?.addEventListener('click', calculate)
2020-02-06 17:09:21 +01:00
calculate()
2023-07-12 23:05:30 +02:00
if (list) list.innerHTML = showAvailableLists().join(', ')