Plugins
Ajax ships eight plugins. Three run by default on every registration — you do
not need to import or configure them. The rest are opt-in: import and pass to
ajax.use() for global scope, or include in the plugins array on a specific
registration.
Built-in
These are always active:
| Plugin | Purpose |
|---|---|
| headers | Adds X-Ajax-Request: true to every fetch |
| scripts | Re-executes <script> tags inside swapped elements |
| events | Dispatches ajax:* CustomEvents on document |
Optional
Import from @erikt/ajax and register with ajax.use() or per-registration:
| Plugin | Purpose |
|---|---|
| loading | Sets aria-busy="true" on an element during a request |
| history | Calls pushState or replaceState after a swap |
| debug | Logs colored, grouped output for every lifecycle stage |
| morph | Replaces the default swap with Idiomorph diffing |
| preload | Preloads links as they scroll into view |