@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) • 741 B
TypeScript
/**
* `@bind` decorator: lazily binds a class prototype method to its instance (`this`).
* - Lazy one-time binding performed on first instance access
* - Access via prototype returns the original (unbound) function
* - Caches bound function on the instance (no further getter overhead)
* - Only applicable to plain prototype methods (not accessors / fields)
* - Reassignment installs the new function as a normal writable value (no rebinding logic)
* - Preserves original enumerability; descriptor remains configurable
*
* @throws TypeError when applied to a non-method
*/
export declare function bind<Fn extends Function>(target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<Fn>): TypedPropertyDescriptor<Fn>;