UNPKG

jelenjs

Version:

Core runtime library for JelenJS - an experimental UI framework with fine-grained reactivity

51 lines (50 loc) 1.76 kB
/** * Component Lifecycle for JelenJS */ /** * Set the current component context (used internally) */ export declare function setCurrentComponent(component: any): void; /** * Get the current component context */ export declare function getCurrentComponent(): any; /** * Register a callback to be executed when the component is mounted to the DOM * @param callback Function to execute after mounting */ export declare function onMount(callback: () => void): void; /** * Register a callback to be executed when the component is unmounted from the DOM * @param callback Function to execute before unmounting */ export declare function onUnmount(callback: () => void): void; /** * Register a callback to be executed when the component updates * @param callback Function to execute on update */ export declare function onUpdate(callback: () => void): void; /** * Similar to React's useEffect, combines onMount, onUpdate and onUnmount * @param callback Effect function that can return a cleanup function * @param deps Optional dependency array for selective updates */ export declare function useEffect(callback: () => (() => void) | void, deps?: any[]): void; /** * Get the current element being rendered */ export declare function getCurrentElement(): HTMLElement | null; /** * Set the current element being rendered (for internal use) */ export declare function setCurrentElement(element: HTMLElement | null): void; /** * Mark a component as mounted and run mount callbacks * @param component The component instance */ export declare function markAsMounted(component: any): void; /** * Handle component unmount and run cleanup * @param component The component instance */ export declare function handleUnmount(component: any): void;