Spasm 0.1.3 released - with bindings to web apis
Sebastiaan Koppe
mail at skoppe.eu
Sat Jan 26 10:24:05 UTC 2019
Spasm is a betterC library for web development that uses LDC to
compile to WebAssembly, and I just released a major update.
It now has bindings to most web api's, like the dom, fetch,
audio, webgl, etc.
So you can do things like this:
---
import spasm.bindings;
import spasm.dom;
import spasm.types;
extern (C) export void _start()
{
auto elem = document.createElement("div").as!HTMLElement;
elem.style.backgroundColor = "green";
elem.innerHTML = "BLA BLA!";
elem.addEventListener("mouseover",(event){
console.log("onmouseover");
console.log(event);
console.log(event.as!MouseEvent.clientX);
});
auto root = document.querySelector("body").front;
root.appendChild(elem);
}
---
And have it Just Work.
See the repo for more info: https://github.com/skoppe/spasm
It is still a WIP but I am getting there.
More information about the Digitalmars-d-announce
mailing list