Open ZeronoFreya opened 4 years ago
Could you provide the full error message?
Could you provide the full error message?
@pravic Only these:
panic: runtime error: cgo argument has Go pointer to Go pointer
moe.go
package main
import (
"log"
"github.com/sciter-sdk/go-sciter"
"github.com/sciter-sdk/go-sciter/window"
)
func setEventHandler(w *window.Window) {
w.DefineFunction("moeRequest", func(args ...*sciter.Value) *sciter.Value {
params := args[0].Get("params")
paramsMap := make(map[string]string)
if params.IsObject() {
params.EnumerateKeyValue(func(key, val *sciter.Value) bool {
log.Println(key.String(), val.String())
paramsMap[key.String()] = val.String()
return true
})
}
return sciter.NewValue("233")
})
}
func main() {
w, err := window.New(sciter.SW_TITLEBAR|
sciter.SW_RESIZEABLE|
sciter.SW_CONTROLS|
sciter.SW_MAIN|
sciter.SW_ENABLE_DEBUG,
&sciter.Rect{Left: 0, Top: 0, Right: 500, Bottom: 500})
if err != nil {
log.Fatal(err)
}
ok := w.SetOption(sciter.SCITER_SET_SCRIPT_RUNTIME_FEATURES, sciter.ALLOW_FILE_IO|
sciter.ALLOW_SOCKET_IO|
sciter.ALLOW_EVAL|
sciter.ALLOW_SYSINFO)
if !ok {
log.Println("enable full fetures failed")
}
fp, err := filepath.Abs("scapp.html")
if err != nil {
log.Fatal(err)
}
w.LoadFile(fp)
w.SetTitle("表单")
setEventHandler(w)
w.Show()
w.Run()
}
html
<html>
<head>
<title></title>
</head>
<body>
<button id="btn">click</button>
</body>
<script type="text/tiscript">
async function getData(){
const str = await view.moeRequest{
params:{
page: 233
}
}
view.msgbox( #information, str);
}
$(#btn).on("click",function(){
getData()
})
</script>
</html>
Thanks, will check it
How did it go? Thanks!
@ZeronoFreya Didn't have a chance to check this up yet, unfortunately.
What should I do? Thanks!