You seem to mix two things. You either use:
Private Sub btn_Click (Params As Map)
Dim code As String = $"
function hi(str){
alert(str);
}"$
ws.Eval(code,Array As String("Hello"))
ws.flush
End Sub
OR you put the javascript code of the hi function in your .html file between <script></script> tags and then use:
Private Sub btn_Click (Params As Map)
ws.RunFunction("hi", Array As String("Hello"))
ws.Flush
End Sub
ws.eval does not add the javascript code to your html, it is 'temporary'.
Alwaysbusy