Git Product home page Git Product logo

angular-wasm's Introduction

Angular & WebAssembly

This project shows how WebAssembly could be used in Angular in form of components and helper services. The examples are written in C/C++ and compiled to WebAssembly using Emscripten.

You can find the following examples:

  • Fibonacci shows the "raw" communication between JavaScript and WebAssembly without using Emscripten's glue code. Inspired by devlucky, the example demonstrates the performance difference between JavaScript and WebAssembly when calculating Fibonacci series using three different implementations.
  • Console Logger binds to window click directly in the C code by using Emscripten's library. The C code uses printf, which I have overloaded to add items to the list instead of printing them to the console (default behavior).
  • Text-to-ASCII allows you to convert text to ASCII art on the fly.
  • BPM-to-ASCII allows you to convert simple bitmaps to ASCII art.
  • 3D Cube shows how you can render 3D graphics using OpenGL (which is then converted to WebGL) and manipulate it on the fly.
  • Proof of Work is a simple Proof of Work system (similar to the one used in bitcoin), which demonstrates activities that might take long time to complete.
  • Person Record shows how to pass complex data between JavaScript and WebAssembly.

Build

You need Docker installed on your machine to compile the C/C++ examples to WebAssembly.

To build the demo locally run:

npm i
npm run wasm
npm start

Then you can open your browser at http://localhost:4200 to see it.

Pre-compiled dependencies

For some of the examples, I have pre-compiled parts of the C/C++ source into linked bitcode (.bc files) to ease the build process.

  • libSOIL - Simple OpenGL Image Library (SOIL) is a tiny C library used primarily for uploading textures into OpenGL

Questions & contribution

You can reach me on Twitter @boyanio. You can also open an issue here on GitHub or make a Pull-Request directly.

angular-wasm's People

Contributors

boyanio avatar dependabot[bot] avatar christianweyer avatar

Watchers

James Cloos 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.