Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Nov 21, 2024

When trying to log the contents of a typed array the old code was doing Array.prototype.slice.call(typed_array) but that doesn't seem necessary.

$ node
> console.log(`hello: ${new Uint8Array(new ArrayBuffer(3))}`);
hello: 0,0,0
> console.log(`hello: ${Array.prototype.slice.call(new Uint8Array(new ArrayBuffer(3)))}`);
hello: 0,0,0

@sbc100 sbc100 requested review from brendandahl and juj November 21, 2024 17:48
When trying to log the contents of a typed array the old code was doing
`Array.prototype.slice.call(typed_array)` but that doesn't seem
necessary.

```
$ node
> console.log(`hello: ${new Uint8Array(new ArrayBuffer(3))}`);
hello: 0,0,0
> console.log(`hello: ${Array.prototype.slice.call(new Uint8Array(new ArrayBuffer(3)))}`);
hello: 0,0,0
```
@sbc100 sbc100 enabled auto-merge (squash) November 21, 2024 22:02
@sbc100 sbc100 requested a review from kripken November 21, 2024 22:02
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in the far past browsers did not log out elements of typed arrays, but did for JS arrays? Yeah, today it works.

@sbc100 sbc100 merged commit eff9671 into emscripten-core:main Nov 21, 2024
28 checks passed
@sbc100 sbc100 deleted the websocket_logging branch November 21, 2024 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants