A context object mapping signal names to their corresponding Signal instances.
Optionalopts: { debug?: boolean; root?: Element }<script src="path/to/indulgent-dom.js"></script>
<script>
const count = indulgent.signal(0);
indulgent.init({
count,
});
indulgent.effect(() => {
console.log('Count changed:', count.get());
});
</script>
<button onclick="count.set(count.get() + 1)">Increment</button>
<p obind:textContent="count"></p>
Initializes Indulgent DOM bindings. Scans the document for elements with
bind:*oriobind:*attributes and sets up reactive bindings. Also observes the DOM for dynamically added elements and applies bindings to them.globalThis.indulgentis defined by including this file. It will contain all indulgent exports, as well as thisinitfunction. This is the easiest way to use Indulgent in a browser environment, as you can simply include this script via a<script>tag from a CDN.It's also perfectly fine to import this file as a module, in which case you can call
initIndulgentdirectly.obind:*creates a one-way binding where changes to the signal update the element property.ibind:*creates a one-way binding where changes to the element property update the signal.iobind:*creates a two-way binding between the signal and the element property.