Documentation - v0.0.1
    Preparing search index...

    Function initIndulgent

    • Initializes Indulgent DOM bindings. Scans the document for elements with bind:* or iobind:* attributes and sets up reactive bindings. Also observes the DOM for dynamically added elements and applies bindings to them.

      globalThis.indulgent is defined by including this file. It will contain all indulgent exports, as well as this init function. 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 initIndulgent directly.

      • 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.

      Parameters

      • ctx: Record<string, Signal<any>>

        A context object mapping signal names to their corresponding Signal instances.

      • Optionalopts: { debug?: boolean; root?: HTMLElement }

      Returns void

      <script src="path/to/indulgent-dom.js"></script>
      <script>
      const count = indulgent.createSignal(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>