gosora/client/main.go

30 lines
631 B
Go

package main
import (
"bytes"
"../common"
"../tmpl_gen/client"
"github.com/gopherjs/gopherjs/js"
)
func main() {
js.Global.Set("weakPassword", func(password string, username string, email string) string {
err := common.WeakPassword(password, username, email)
if err != nil {
return err.Error()
}
return ""
})
js.Global.Set("renderAlert", func(asid int, path string, msg string, avatar string) string {
var buf bytes.Buffer
alertItem := common.AlertItem{asid, path, msg, avatar}
err := tmpl.Template_alert(alertItem, &buf)
if err != nil {
println(err.Error())
}
return string(buf.Bytes())
})
}