package once

var helloHandle = templ.NewOnceHandle()

templ hello(label, name string) {
	@helloHandle.Once() {
		<script>
			function hello(name) {
				alert("Hello, " + name + "!");
			}
		</script>
	}
	<input type="button" value={ label } data-name={ name } onclick="hello(this.getAttribute('data-name'))"/>
}

templ render() {
	@hello("Hello User", "user")
	@hello("Hello World", "world")
}
