javascript utility for creating DOM trees from arrays.
Find a file
2023-07-16 15:22:58 +02:00
assets/styles init. 2023-07-14 21:47:43 +02:00
js clean up dev branch to make merging easier. 2023-07-16 15:15:17 +02:00
favicon.ico init. 2023-07-14 21:47:43 +02:00
index.html clean up dev branch to make merging easier. 2023-07-16 15:15:17 +02:00
README.md add readme. 2023-07-16 15:22:58 +02:00

small utility for creating DOM trees from javascript arrays.

to use, clone/submodule/subtree/whatever the main branch, and import json_as_html from export.mjs.

to see a demo, or contribute, clone the dev branch.

here's the demo array being used at the time of writing this:

[
	"div",
	[
		["id", "wrapper"],
		["class", "demo_div"],
	],
	[
		["h1", [], "header :)"],
		["p", [], "paragraph! meow"],
		["p", [], "another paragraph!! this is so cool"],
		state => ["button", [
			["onclick", _ => {
				state.set("clicked", true);
				render();
			}]
		], "it can even do buttons!"],
		state => ["p", [], state.get("clicked") ? "clicked" : "not clicked"],
	],
]

it assumes a function render which replaces the contents of the <body> with the result of calling json_as_html with this array as argument. it also assumes a Map called state.