Refactor detector function

This commit is contained in:
esimov
2019-11-11 16:56:50 +02:00
parent ef71fb276f
commit 738690cde7
3 changed files with 95 additions and 64 deletions

View File

@@ -34,6 +34,7 @@ func (d *Detector) FetchCascade(url string) ([]byte, error) {
response.Call("arrayBuffer").Call("then", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
go func() {
buffer := args[0]
fmt.Println(buffer.Get("byteLength").Int())
uint8Array := js.Global().Get("Uint8Array").New(buffer)
jsbuf := make([]byte, uint8Array.Get("length").Int())