Git Product home page Git Product logo

wasm-ts-tinygo's Introduction

WASM TYPESCRIPT TINYGO

A sample project that uses Tinygo WASM and Typescript. To get started with this project install:

  1. Yarn - installation instructions
  2. Tinygo - installation instructions

Then when installed you can build the project with:

make install
make all

Client

We use React, and Typescript for a simple web interface. We have built our own webpack build configuration to allow us to circumvent the opinionated build system of CRA and enable the use of Go WASM files.

Webassembly

The core calculations in the widget are done using webassembly. Tinygo is required to be installed. The wasm file can be compiled as follows:

tinygo build -o ../server/dist/wasm.wasm -target wasm main.go

Server

A simple go based web server that uses the air module to do live reloads. The server can be started with the following:

air

Air is pretty awesome for rapid development with Go. Check it out: Air.

Setup

To set this up one must have Tinygo installed and must update the location to the wasm_exec.js file. This will be in a path such as on mac and needs to be copied into the server/dist directory:

cp /usr/local/Cellar/tinygo/0.15.0/targets/wasm_exec.js server/dist

For this project I have copied my wasm_exec.js file into the client/src directory; it then gets built into the final project.

References

This project only exists because of the following articles:

  1. WASM with React
  2. Webpack Golang WASM loader
  3. WASM Go with React
  4. Tic Tac Toe WASM Go
  5. Webpack React Tutorial
  6. Webpack with Typescript
  7. IMPORTANT TS WASM REACT GO
  8. Webpack WASM loader Github
  9. Tinygo FinalizeRef Fix
  10. Tinygo WASM examples

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.