UNPKG

class-autobind-decorator

Version:

A small framework-agnostic utility for auto-binding "class" methods to instances (with customization options) using either "legacy" decorator syntax or plain old ES5 (without needing ES2015+ polyfills).

16 lines (12 loc) 591 B
export type ConstructorFunction<T> = { new(...args: any[]): T; }; export interface InputOptions { methodsToIgnore?: Array<string>; dontOptimize?: boolean } export function autoBindMethods<T = any>(target: ConstructorFunction<T>): void; export function autoBindMethods<T = any>(input?: InputOptions): (target: ConstructorFunction<T>) => void; export function autoBindMethodsForReact<T = any>(target: ConstructorFunction<T>): void; export function autoBindMethodsForReact<T = any>(input?: InputOptions): (target: ConstructorFunction<T>) => void; export default autoBindMethods;