Sub BANano_Ready()
Dim body As BANanoElement
body.Initialize("body")
' just creating a label and a button
body.Append($"<div id="label">Mouse out count: 0</div><button id="btn">Btn clicks count: 0</button>"$)
'var btn = document.getElementById('btn');
Dim btn As BANanoElement
btn.Initialize("#btn")
'var label = document.getElementById('label');
Dim label As BANanoElement
label.Initialize("#label")
' for the anonymous functions and B4J needs the variable to be declared else you get an syntax error in the IDE
Dim count As Int
' anonymous button function to pass to the Hoc Class
Dim buttonHocFunc As BANanoObject 'ignore
buttonHocFunc.Sub(count)
btn.SetText("Btn clicks count: " & count)
buttonHocFunc.EndSub
Dim buttonHoc As Hoc
buttonHoc.Initialize(buttonHocFunc)
' anonymous label function to pass to the Hoc Class
Dim labelHocFunc As BANanoObject 'ignore
labelHocFunc.Sub(count)
label.SetText("Mouse out count: " & count)
labelHocFunc.EndSub
Dim labelHoc As Hoc
labelHoc.Initialize(labelHocFunc)
' add the event listeners
btn.AddEventListener("click", BANano.CallBack(buttonHoc,"Increase", Null), Null)
label.AddEventListener("mouseout", BANano.CallBack(labelHoc,"Increase", Null), Null)
End Sub