canihazusername/demo/main.ts

17 lines
521 B
TypeScript
Raw Normal View History

2020-02-05 22:48:14 +01:00
import 'bulma/css/bulma'
import { showAvailableLists, generate } from '../'
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')
2020-02-06 17:09:21 +01:00
const 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
button.addEventListener('click', calculate)
calculate()
2020-02-05 22:48:14 +01:00
list.innerHTML = showAvailableLists().join(', ')