GithubHelp home page GithubHelp logo

nethelper_wasm's Introduction

nethelper_wasm

nethelper_wasm is a library that provides JavaScript-compatible wrappers for netcalc logic, enabling its use in web apps.
This library exposes only the safe functions that can be used in JavaScript.

How to compile to *.WASM

  1. Install wasm-pack by running the following command: cargo install wasm-pack
  2. Run wasm-pack build --target web to compile the library to WebAssembly.

How to use WASM in React

After compiling the library with wasm-pack build --target web:

  1. Navigate to your React project and open package.json
  2. Under "dependencies", add "wasm": "file:~/nethelper_wasm/pkg"
  3. In the root directory of your React project, run npm install
  4. Import the functions you need in your React components with import { function_name } from "wasm"
  5. Use the imported functions in your React components

FAQ

  1. The file package.json is missing inside /pkg/:
    Follow this fix or manually create it.

Example package.json

{
  "name": "nethelper_wasm",
  "collaborators": [
    "name <email>"
  ],
  "version": "0.1.0",
  "files": [
    "nethelper_wasm_bg.wasm",
    "nethelper_wasm.js",
    "nethelper_wasm.d.ts"
  ],
  "module": "nethelper_wasm.js",
  "types": "nethelper_wasm.d.ts",
  "sideEffects": false
}

nethelper_wasm's People

Contributors

mour0 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.