svelte-wasm
v0.0.4
Published
`svelte-wasm` is a WIP library for integrating WebAssembly (WASM) modules with Svelte applications. It provides utilities to load and interact with WASM modules seamlessly in Svelte projects.
Downloads
240
Readme
svelte-wasm
svelte-wasm
is a WIP library for integrating WebAssembly (WASM) modules with Svelte applications. It provides utilities to load and interact with WASM modules seamlessly in Svelte projects.
Overview
This library allows you to load WebAssembly modules and call their functions directly from your Svelte components, leveraging the performance benefits of WASM in a Svelte environment.
Installation
To install the svelte-wasm
library, use npm or yarn:
npm install svelte-wasm
# or
yarn add svelte-wasm
Usage
Here's a basic example of how to use svelte-wasm in a Svelte application:
<script>
import { loadWasmModule } from 'svelte-wasm';
let wasmModule;
let result;
async function initializeWasm() {
try {
wasmModule = await loadWasmModule('/path/to/your/module.wasm');
result = wasmModule.instance.exports.yourFunction();
} catch (error) {
console.error('Failed to load WASM Module:', error);
}
}
initializeWasm();
</script>
<main>
<h1>WASM Result: {result}</h1>
</main>
Contribution
Please ensure that your code follows the project's coding standards and includes appropriate tests. Contribution guidelines would be released shortly
License
This project is licensed under the MIT License. See the LICENSE file for details.