Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docs #24

Open
pietgeursen opened this issue Jan 13, 2021 · 6 comments
Open

Improve docs #24

pietgeursen opened this issue Jan 13, 2021 · 6 comments

Comments

@pietgeursen
Copy link
Owner

  • Examples!
  • Some kind of an overview of the whole thing
@pietgeursen pietgeursen mentioned this issue Jan 13, 2021
5 tasks
@arj03
Copy link

arj03 commented Jan 13, 2021

Would be really interested in seeing wasm examples :-)

@adzialocha
Copy link

Would be really interested in seeing wasm examples :-)

@arj03, you can check out the p2panda project were we ..

  1. .. have a proof-of-concept with wasm and bamboo:
    https://github.com/p2panda/beep-beep-client

  2. .. have the p2panda-js library which will help to build p2panda clients. This is a little bit more sophisticated and totally WIP:
    NodeJS and browser support p2panda/p2panda#21

@pietgeursen
Copy link
Owner Author

@arj03

Would be really interested in seeing wasm examples :-)

I finally tidied up the wasm stuff in this repo and published it to NPM as @bamboo-logs/bamboo-wasm

Slight aside: I built it for node (and I've tested it working there) but I'm not sure if that's gonna be a pain to bundle it for a browser. wasm-pack allows building for bundlers like webpack too which might be a better idea. Not sure yet. Happy for input.

I started writing @bamboo-logs/bamboo-log that will wrap this module. But it's not done.

@arj03
Copy link

arj03 commented Jan 15, 2021

Fantastic @pietgeursen. Really like the progress here. I'm pretty busy atm, so mostly just checking how this is coming along. Might run a few tests once bamboo-log is in place.

@adzialocha
Copy link

adzialocha commented Jan 15, 2021

Slight aside: I built it for node (and I've tested it working there) but I'm not sure if that's gonna be a pain to bundle it for a browser. wasm-pack allows building for bundlers like webpack too which might be a better idea. Not sure yet. Happy for input.

We've been just experimenting with this and its relatively easy when using the bundler target in wasm-pack and syncWebAssembly flag in WebPack (async still makes some problems).

In p2panda-js we're building a library with an JavaScript + WASM hybrid (we also want to write methods to do RPC calls in the js library and that would be a pain to write in Rust) therefore we needed to do the bundling before it gets imported by other projects. We have a pipeline building the WASM with the web target THEN encoding it as a base64 string and then loading it manually like this: https://github.com/p2panda/p2panda/blob/improve-js-build/p2panda-js/src/wasm-adapter/browser.ts. It all gets bundled inline and minified in a single index.min.js and we point at it in the package.json via the browser field.

The cool thing about this is that you don't need any Bundler at all anymore, you can just import the library and use it directly in modern browsers. But I don't think this needs to be a requirement for the bamboo lib? The WebPack bundler scenario is also sufficient for pure wasm libraries if the projects already have it set up.

@pietgeursen
Copy link
Owner Author

Thanks so much for that @adzialocha! I was wondering if bundler was the way to go, sounds like it is. Thanks!

@pietgeursen pietgeursen mentioned this issue Jan 17, 2021
Merged
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

No branches or pull requests

3 participants