Skip to content

Repository files navigation

GacJS

Read the LICENSE first.

Running GacUI in browsers with WebAssembly is GacJS's primary purpose and most important feature. The current demos load the GacUI C++ core as a .wasm file in a browser worker, render its UI with HTML5, and can implement its view model in TypeScript.

Both the HTML5 renderer and the TypeScript view-model host connect to the core through exposed WebAssembly functions and callbacks. This reuses GacUI Remote Protocol for rendering and Workflow RPC for view models. WebAssembly and HTTP are alternative transports for those channels; HTTP support primarily makes it possible to test HTML5 rendering without building WebAssembly.

Documentation

Area Document
Architecture Project Structure
WebAssembly demos Running the Wasm Demos on Linux
Network transport and handshakes GacJS Network Protocol
Remote Protocol GacUI Remote Protocol Reference
Rendering GacUI HTML DOM Rendering
Rich text DocumentParagraph Implementation
E2E testing Testing the Remote Protocol with Playwright
Snapshot testing Testing with Snapshots
Workflow RPC Workflow Interface-Based RPC
Workflow RPC lifetime Memory Management for Workflow RPC in TypeScript
Workflow RPC bindings Generating TypeScript Bindings for Workflow RPC

Building this Project

The root of test projects is in the Gaclib folder, yarn build and you will get all files created to Gaclib\website\entry\lib\dist.

Run in Browser

WebAssembly

The existing demos run the core inside the browser. To prepare them on Linux:

  1. Build WasmFCT, WasmRPT, and WasmRVMT in the sibling GacUI checkout. From each GacUI/Test/Linux/<project> directory, run ../../../.github/Ubuntu/build.sh -bw -o.
  2. Build GacJS with yarn build from Gaclib.
  3. From Gaclib, run ../copy-wasm.sh to copy each demo's matching app.mjs, app.wasm and app.worker.js into the website. Repeat this after every website build because that build cleans the output directory.

See the WebAssembly build guide for details. The website build does not compile or copy the WebAssembly binaries automatically.

From Gaclib/website/entry, start the website on port 8896:

npm run start

Open one of these pages:

Page Demo
FullControlTest Control showcase
RemoteProtocolTest Remote rendering features
RemoteViewModelTest HTML5 rendering and a TypeScript view model connected to the WebAssembly core

The website server supplies the module files and shared-memory headers; application traffic uses WebAssembly functions through the worker, without a separate HTTP core process. Press ENTER in the server terminal when you want to stop serving the website.

HTTP testing

For testing the same HTML5 renderer against a native core, run RemotingTest_Core with /Http on Windows or /MiniHttp on Windows, Linux, or macOS. Start the website as above and open the HTTP renderer.

For a TypeScript view model over HTTP, run Core with /RVMT /Http or /RVMT /MiniHttp and open the renderer with a TypeScript host, without starting a separate view-model host.

RPT_Windows RPT_Ubuntu RPT_macOS

Interacting with GacUI Core

GacUIHtml2

Switching between Renderers

You can start a local RemotingTest_Win32_Renderer with /Http, do something to the UI, and start the website, you can see the website take over the running UI on the fly.

GacUIHtml2

localhost/snapshots.html

A demo for rendering GacUI Unit Test with Snapshots

SnapshotViewer

About

Running GacUI in Browsers!

Resources

Stars

216 stars

Watchers

34 watching

Forks

Releases

Packages

Contributors

Languages