rust-calculator
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

rust-calculator

This is a very bare bones calculator made for the purposes of exploring Web Assembly. I don't think there is any viable reason for using it. So don't.

But if you want to...

Installation

npm install rust-calculator

Importing a web assembly module is a little different than normals JS modules. They must be imported asynchronously.

const wasm = import('rust-calculator');

wasm.then(calculator => {
  calculator.calculate(4.0, 3.0, '*');
});

I believe you can get around the asynchronous syntax with some configuring in Webpack 4.

API

.calculate(number, number, operator) -> number

The operator must be a string, and one of +, -, /, *. Returns a number.

Readme

Keywords

none

Package Sidebar

Install

npm i rust-calculator

Weekly Downloads

1

Version

0.1.2

License

none

Unpacked Size

12.7 kB

Total Files

5

Last publish

Collaborators

  • rdubrock