question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add browser support?

See original GitHub issue

I’ve recently been having quite a bit of trouble with the browser’s built-in Map:

So I went hunting and found your project - it looks great! Is there any interest in making it browser-compatible by detecting if the code is running in a browser and switching out Buffer for ArrayBuffer? Or even just using feross’s browser-based buffer polyfill? https://github.com/feross/buffer

For crypto.randomBytes, there’s this isomorphic lib: https://www.npmjs.com/package/randombytes

Edit: Here’s a working proof of concept: https://gist.github.com/josephrocca/019f091e5f83e410533caeb6f371200e

All I did was:

npm install buffer
npm install randombytes

Then, in index.js, swap require('crypto').randomBytes for require('randombytes'), and then just:

npm install -g browserify
browserify index.js -o HashTable.mjs

I haven’t used browserify before so that linked script pulls HashTable and Buffer out of the module in a weird way… but it works! (see bottom of HashTable.mjs)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jorangreefcommented, Jun 9, 2019

learning Rust, so I’ll probably submit less-noobish bug reports to V8 crbug over time.

Rust is cool, https://ziglang.org is also worth checking out. Zig’s error handling sets are awesome. It strikes an almost perfect balance. It’s closer to C than Rust, which is closer to C++.

I’m also a mere web developer and I don’t think my own noobish bug reports ever get better over time. 😅 Always worth submitting a crbug!

1reaction
josephroccacommented, Jun 9, 2019

Thanks! I will definitely check out Zig 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can I use... Support tables for HTML5, CSS3, etc
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >
Browser support for JavaScript APIs - Mozilla - MDN Web Docs
Browser support for JavaScript APIs. action. Report problems with this compatibility data on GitHub. desktop, mobile. Chrome. Edge. Firefox. Opera. Safari.
Read more >
Sign in with a supported browser - Android - Google Support
Sign in with a supported browser · Step 1. Use a supported browser · Step 2. Turn on JavaScript in Chrome.
Read more >
How To Build Cross-Browser Compatible Websites - WP Engine
Why Is Cross-Browser Compatibility Important? Most people use well-known browsers, such as Google Chrome, Safari, Firefox, and Opera.
Read more >
CSS Browser Support Reference - W3Schools
Property Edge Firefox Chrome Safari Opera accent‑color 93 92 93 15.4 79 align‑content 11 28 21 9 12.1 align‑items 11 20 21 9 12.1
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found