UNPKG

@anywhichway/lazui

Version:

Single page apps and lazy loading sites with minimal JavaScript or client build processes.

12 lines (10 loc) 454 B
const __TEMPLATE_CONTENT__ = new WeakMap(); function render({el,attribute,root,state,lazui}) { const fname = attribute.value, f = state[fname] || root[fname] || window[fname]; let template = __TEMPLATE_CONTENT__.get(el); if(!template && el.firstElementChild?.tagName==="TEMPLATE") template = el.firstElementChild; if(template) __TEMPLATE_CONTENT__.set(el,template); f({el,template,state,lazui}) } export {render};