Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for CopyBytesToJS (0.15 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/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