npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

webformscore-wasm

v2.1.0

Published

webforms.ts WebAssembly Commander library for WebForms Core

Readme

WebForms Core for AssemblyScript

WebForms Core can be used with AssemblyScript to create WebAssembly modules that generate WebForms Core commands.

The AssemblyScript WebForms class acts as a Commander inside the WebAssembly module. It can generate WebForms Core responses that are executed by the WebFormsJS Executor in the browser.

How to work with WebForms Core in AssemblyScript

First, create an AssemblyScript project and add the WebForms Core AssemblyScript classes to your project.

The following example contains several exported WebAssembly methods. The add method performs a simple calculation, while the setData method creates a WebForms instance and generates commands that modify the HTML page.

import { WebForms } from "./webforms";

export function add(a: i32, b: i32): i32 {
    return a + b;
}

export function setData(
    inputPlace: string,
    text: string,
    backgroundColor: string,
    fontSize: string
): string {
    const form = new WebForms();
    form.setText(inputPlace, text);
    form.setBackgroundColor("-", backgroundColor);
    form.setFontSize("-", fontSize);
    return form.response();
}

export function getHtml(): string {
    return "<marquee>Tag From Wasm!</marquee>";
}

export function createWebForms(): WebForms {
    return new WebForms();
}

The methods that should be called from the host application must be exported from the AssemblyScript module.

After compiling the AssemblyScript project, the resulting .wasm file can be called from a server application through WebForms Core.

Calling AssemblyScript WebAssembly from CodeBehind

The following CodeBehind controller uses the AssemblyScript WebAssembly module.

using CodeBehind;

public partial class WasmAssemblyScriptController : CodeBehindController
{
    public void PageLoad(HttpContext context)
    {
        string WasmPath = "/web-assembly/assembly-script/release.wasm"; // or release.js, support both.
        WebForms form = new WebForms();

        form.AddText("<b>", Fetch.WasmMethod(WasmLanguage.AssemblyScript, WasmPath, "add", [10000, 3]));

        form.SetWasmEvent("WasmEvent", HtmlEvent.OnClick, WasmLanguage.AssemblyScript, WasmPath, "setData", ["h3Tag", "Text From Wasm", "lightgreen", "30px"]);
        form.SetWasmEvent("WasmEventWithOutput", HtmlEvent.OnClick, WasmLanguage.AssemblyScript, WasmPath, "getHtml", [], "WasmHtmlOutput");

        Write(form.ExportToHtmlComment());
    }
}

The Fetch.WasmMethod method calls an exported AssemblyScript method and returns its result.

In this example:

Fetch.WasmMethod(WasmLanguage.AssemblyScript, WasmPath, "add", [10000, 3])

the add method inside the WebAssembly module is executed with the values 10000 and 3. Its result is then added to the WebForms Core response.

The SetWasmEvent method assigns a WebAssembly method to a browser event. When the user clicks the WasmEvent button, the setData method in the AssemblyScript WebAssembly module is executed.

The setData method returns a WebForms Core response containing commands that change the HTML element with the h3Tag ID.

The second SetWasmEvent call executes the getHtml method and places its returned HTML into the WasmHtmlOutput element.

View

The CodeBehind controller can be used with the following view:

@page
@controller WasmAssemblyScriptController
@layout "/layout.aspx"
@{
  ViewData.Add("title","AssemblyScript Wasm");
}
<h3>AssemblyScript Wasm</h3>
<b>AssemblyScript WASM Result: </b>
<br>
<button id="WasmEvent">Wasm Event</button>
<br>
<h3 id="h3Tag">Wasm Tag Changing!</h3>
<button id="WasmEventWithOutput">Wasm Event With Output</button>
<p id="WasmHtmlOutput">Wasm Html Output</p>

The page contains two buttons.

The first button executes the setData method from the AssemblyScript WebAssembly module. The method generates WebForms Core commands that change the text, background color, and font size of the h3Tag element.

The second button executes the getHtml method. The returned HTML is placed inside the WasmHtmlOutput element.

WebForms Core and WebAssembly

In this model, AssemblyScript does not directly manipulate the browser DOM.

The AssemblyScript module generates either a value or a WebForms Core response. WebForms Core then passes the generated commands to the WebFormsJS Executor, which executes them against the HTML DOM.

This allows AssemblyScript WebAssembly modules to participate in WebForms Core applications while keeping DOM execution in the browser runtime.

After learning this simple example, you can use the WebForms Core WebForms class inside AssemblyScript modules to generate more advanced server and browser interactions.