UNPKG

rynex

Version:

A minimalist TypeScript framework for building reactive web applications with no virtual DOM

40 lines 1.49 kB
/** * Rynex Lifecycle Hooks * Component lifecycle management */ type CleanupFunction = () => void; type EffectFunction = () => void | CleanupFunction; /** * Component mount lifecycle hook * Executes callback when element is mounted to DOM */ export declare function onMount(element: HTMLElement, callback: () => void | CleanupFunction): void; /** * Component unmount lifecycle hook * Executes callback when element is removed from DOM */ export declare function onUnmount(element: HTMLElement, callback: CleanupFunction): void; /** * Component update lifecycle hook * Executes callback when element attributes or children change */ export declare function onUpdate(element: HTMLElement, callback: (mutations: MutationRecord[]) => void): CleanupFunction; /** * Watch a reactive value and execute callback when it changes * Returns cleanup function */ export declare function watch<T>(getter: () => T, callback: (newValue: T, oldValue: T) => void, options?: { immediate?: boolean; }): CleanupFunction; /** * Watch effect - runs effect immediately and re-runs when dependencies change * Similar to effect but with explicit cleanup handling */ export declare function watchEffect(effectFn: EffectFunction): CleanupFunction; /** * On error handler for component errors * Catches and handles errors within a component tree */ export declare function onError(element: HTMLElement, handler: (error: Error) => void): void; export {}; //# sourceMappingURL=lifecycle.d.ts.map