@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
13 lines (12 loc) • 811 B
TypeScript
import type { AnyToVoidFnSignature } from '../misc/functions';
/**
* `@ready` decorator: defers method execution until DOM is ready, then runs it in the next macrotask.
* - Wraps a void method so each call schedules execution (arguments captured) after `DOMContentLoaded`
* - If DOM already ready, still defers via `setTimeout(..., 0)` (next task boundary)
* - Multiple calls before readiness schedule multiple executions (no coalescing)
* - Return value is always `undefined` (original result not obtainable due to async defer)
* - Exceptions inside deferred callback surface asynchronously (not caught)
*
* @throws TypeError when applied to a non-method
*/
export declare function ready<T extends AnyToVoidFnSignature>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): void;