https://github.com/jcbhmr/hello-world-rust-wasm-component-lib.js
🔗 JavaScript bindings for jcbhmr/hello-world-rust-wasm-component-lib
https://github.com/jcbhmr/hello-world-rust-wasm-component-lib.js
component rust wasi wasm wasm-component webassembly webassembly-component
Last synced: about 1 month ago
JSON representation
🔗 JavaScript bindings for jcbhmr/hello-world-rust-wasm-component-lib
- Host: GitHub
- URL: https://github.com/jcbhmr/hello-world-rust-wasm-component-lib.js
- Owner: jcbhmr
- License: 0bsd
- Created: 2023-12-27T20:26:09.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-03T17:08:42.000Z (about 1 year ago)
- Last Synced: 2025-03-09T10:48:16.540Z (2 months ago)
- Topics: component, rust, wasi, wasm, wasm-component, webassembly, webassembly-component
- Language: HTML
- Homepage: https://tsdocs.dev/docs/hello-world-rust-wasm-component-lib
- Size: 618 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JavaScript bindings for "Hello world!" Rust WebAssembly component library
🔗 JavaScript bindings for [jcbhmr/hello-world-rust-wasm-component-lib]
```js
run();
//=> Hello Alan Turing!console.log(getReport());
//=> {
// bouncyCastles: 100,
// funPercent: 0.9,
// catCount: 8,
// unicornNames: [ 'Fluffy', 'Marshmallow', 'Sparkles' ]
// }console.log(computeArea({ center: { x: 0, y: 0 }, radius: 6 }));
//=> 113.09733552923255console.log(greetMany(["Alan Turing", "Ada Lovelace"]));
//=> Hello, Alan Turing!
// Hello, Ada Lovelace!
```🏷️ Using v1.0.0 of [jcbhmr/hello-world-rust-wasm-component-lib] \
🦀 WASM is written in Rust \
🟦 Includes TypeScript type definitions \
📦 Published as an npm package \
👩⚖️ [0BSD licensed](./LICENSE) template## Installation





You can install this package using your favorite npm package manager like npm,
[Yarn], [pnpm], or [Bun].```sh
npm install hello-world-rust-wasm-component-lib
```If you're using [Deno] you can import it straight from npm:
```js
import {} from "npm:hello-world-rust-wasm-component-lib";
```If you prefer to go buildless in the browser you can use an npm CDN like
[jsDelivr] or [esm.sh].```html
import {} from "https://esm.run/hello-world-rust-wasm-component-lib";
```
## Usage



You should be able to just import and use this JavaScript package like any
other. The WASM magic is hidden behind a really nice wrapper layer.```js
import {
greetMany,
run,
getReport,
computeArea,
} from "hello-world-rust-wasm-component-lib";run();
//=> Hello Alan Turing!console.log(getReport());
//=> {
// bouncyCastles: 100,
// funPercent: 0.9,
// catCount: 8,
// unicornNames: [ 'Fluffy', 'Marshmallow', 'Sparkles' ]
// }console.log(computeArea({ center: { x: 0, y: 0 }, radius: 6 }));
//=> 113.09733552923255console.log(greetMany(["Alan Turing", "Ada Lovelace"]));
//=> Hello, Alan Turing!
// Hello, Ada Lovelace!
```[📚 Read more about the API surface on the documentation website](https://tsdocs.dev/docs/hello-world-rust-wasm-component-lib)
## Development

**Versioning scheme:** Use `1.2.3+4.5.6` where `1.2.3` is the main JS bindings
API version (this package) and `4.5.6` is the version of the upstream WASM
underlying library that was used to generate the JavaScript bindings. The
`1.2.3+4.5.6` versioning scheme was adopted so that users of a particular
version can quickly see which version of the WASM library was used. Note that
the `+4.5.6` part is **just metadata**. You can't publish both `1.2.3+4.5.6` and
`1.2.3+7.8.9`. Think of it like a super important `"description"` field.[jcbhmr/hello-world-rust-wasm-component-lib]: https://github.com/jcbhmr/hello-world-rust-wasm-component-lib
[Yarn]: https://yarnpkg.com/
[pnpm]: https://pnpm.io/
[Bun]: https://bun.sh/
[Deno]: https://deno.com/
[jsDelivr]: https://www.jsdelivr.com/
[esm.sh]: https://esm.sh/