mirror of
https://github.com/kou029w/_.git
synced 2025-01-31 06:18:07 +00:00
10 lines
280 B
TypeScript
10 lines
280 B
TypeScript
|
export function setupCounter(element: HTMLButtonElement) {
|
||
|
let counter = 0;
|
||
|
const setCounter = (count: number) => {
|
||
|
counter = count;
|
||
|
element.innerHTML = `count is ${counter}`;
|
||
|
};
|
||
|
element.addEventListener("click", () => setCounter(counter + 1));
|
||
|
setCounter(0);
|
||
|
}
|