Crate canvas_app

Crate canvas_app 

Source
Expand description

§Saorsa Canvas WASM Application

This crate provides the WASM bindings for the Saorsa Canvas, enabling the canvas to run in web browsers.

§Usage

Build for WASM:

wasm-pack build --target web canvas-app

Then import in JavaScript:

import init, { CanvasApp } from './pkg/canvas_app.js';

await init();
const app = new CanvasApp('main-canvas');

function render() {
    app.render();
    requestAnimationFrame(render);
}
render();

Structs§

CanvasApp
The main canvas application for WASM.

Functions§

create_chart_element
Create a chart element JSON with sample data.
create_chart_with_data
Create a chart element JSON with custom data.
create_image_element
Create an image element JSON.
create_text_element
Create a text element JSON.
create_video_element
Create a video element JSON.
init_wasm
Initialize the WASM module.