New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

crdts-wasm

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crdts-wasm

Proof of concept to utilizing the `crdts` [rust crate](https://github.com/rust-crdt/rust-crdt) in Javascript via WebAssembly.

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rust-crdts wasm

Proof of concept to utilizing the crdts rust crate in Javascript via WebAssembly.

The chief challenge in utilizing crdts via WebAssembly is that wasm-bindgen can't currently handle Rust structures with type parameters (which crdts extensively utilizes).

As such, this proof of concept takes a wrapping approach, building materialized structs for a CRDT / type pair that they can be consumed in JavaScript.

See src/lib.rs for details on how the mechanics of this wrapping work and at index.html for what the JavaScript client looks like.

Running POC Demo

  1. Install the WASM toolchain for Rust if you haven't already:
$ rustup target add wasm32-unknown-unknown
  1. Install wasm-pack toolchain:
$ cargo install wasm-pack
  1. Build the demo in WebAssembly using wasm-pack:
$ wasm-pack build --target web
  1. Start a static webserver in the root of the application:
$ python3 -m http.server
  1. Launch your web browser and navigate to http://localhost:8000 - open your console to see that indeed that the counter is successfully run in JavaScript and outputs a 1.

FAQs

Package last updated on 16 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc