Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for CopyBytesToJS (0.24 sec)

  1. src/syscall/js/js.go

    // CopyBytesToJS copies bytes from src to dst.
    // It panics if dst is not a Uint8Array or Uint8ClampedArray.
    // It returns the number of bytes copied, which will be the minimum of the lengths of src and dst.
    func CopyBytesToJS(dst Value, src []byte) int {
    	n, ok := copyBytesToJS(dst.ref, src)
    	runtime.KeepAlive(dst)
    	if !ok {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 19 14:35:26 UTC 2024
    - 19.5K bytes
    - Viewed (0)
  2. src/net/http/roundtrip_js.go

    		if err != nil {
    			req.Body.Close() // RoundTrip must always close the body, including on errors.
    			return nil, err
    		}
    		req.Body.Close()
    		if len(body) != 0 {
    			buf := uint8Array.New(len(body))
    			js.CopyBytesToJS(buf, body)
    			opt.Set("body", buf)
    		}
    	}
    
    	fetchPromise := js.Global().Call("fetch", req.URL.String(), opt)
    	var (
    		respCh           = make(chan *Response, 1)
    		errCh            = make(chan error, 1)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 10 03:29:50 UTC 2024
    - 11.8K bytes
    - Viewed (0)
  3. src/syscall/js/js_test.go

    			src := make([]byte, tt.srcLen)
    			if tt.srcLen >= 2 {
    				src[1] = 42
    			}
    			dst := js.Global().Get("Uint8Array").New(tt.dstLen)
    
    			if got, want := js.CopyBytesToJS(dst, src), tt.copyLen; got != want {
    				t.Errorf("copied %d, want %d", got, want)
    			}
    			if tt.dstLen >= 2 {
    				if got, want := dst.Index(1).Int(), 42; got != want {
    					t.Errorf("got %d, want %d", got, want)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 19 14:35:26 UTC 2024
    - 17.7K bytes
    - Viewed (0)
Back to top