mirror of
https://github.com/syumai/workers.git
synced 2025-03-10 17:29:11 +00:00
add NewUUID() to jsutil
This commit is contained in:
parent
b8bd0f88dc
commit
f25a65c45a
@ -18,6 +18,7 @@ var (
|
||||
ErrorClass = Global.Get("Error")
|
||||
ReadableStreamClass = Global.Get("ReadableStream")
|
||||
DateClass = Global.Get("Date")
|
||||
Crypto = Global.Get("crypto")
|
||||
)
|
||||
|
||||
func NewObject() js.Value {
|
||||
@ -102,3 +103,7 @@ func DateToTime(v js.Value) (time.Time, error) {
|
||||
func TimeToDate(t time.Time) js.Value {
|
||||
return DateClass.New(t.UnixMilli())
|
||||
}
|
||||
|
||||
func NewUUID() string {
|
||||
return Crypto.Call("randomUUID").String()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user