@alwatr/synapse
Version:
Connect your TypeScript classes to the DOM, declaratively.
24 lines • 934 B
TypeScript
/**
* Initializes all registered directives within a given root element.
* If no root element is provided, it scans the entire body.
*
* This function is idempotent; it will not re-initialize a directive on an element
* that has already been processed.
*
* @param rootElement The element to scan for directives. Defaults to `document.body`.
*
* @example
* ```ts
* // Initialize directives on the whole page after the DOM is loaded.
* document.addEventListener('DOMContentLoaded', () => bootstrapDirectives());
*
* // Or, initialize directives on a dynamically added part of the page.
* const newContent = document.createElement('div');
* newContent.innerHTML = '<div class="my-button">Click Me</div>';
* document.body.appendChild(newContent);
*
* bootstrapDirectives(newContent);
* ```
*/
export declare function bootstrapDirectives(rootElement?: Element | Document): void;
//# sourceMappingURL=bootstrap.d.ts.map