Commit 642b9c2a authored by Alex Browne's avatar Alex Browne Committed by Steven Allen

Simplify iteration over Uint8Array

parent b84e264b
......@@ -115,8 +115,8 @@ func (c *Conn) Write(b []byte) (n int, err error) {
return 0, err
}
uint8Array := js.Global().Get("Uint8Array").New(len(b))
for i := 0; i < len(b); i++ {
uint8Array.SetIndex(i, b[i])
for i, bi := range b {
uint8Array.SetIndex(i, bi)
}
c.Call("send", uint8Array.Get("buffer"))
return len(b), nil
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment