Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am halicea on github.
  • I am halicea (https://keybase.io/halicea) on keybase.
  • I have a public key ASCm_btCsuguA7fSd3CRxN2uVKgVV560mnUVtC5sWxDxoQo

To claim this, I am signing this object:

@Halicea
Halicea / render.js
Last active October 5, 2024 11:05
rendering of templates inspired by htmx
const templateCache = {}
let render = async (data, selector, target, swap = "innerHTML") => {
let cache = templateCache["selector"];
if(cache){
tmpl = cache;
}
else if(selector.startsWith("/")){
try {
const res = await fetch(selector);
if (res.status === 200){