UNPKG

impair

Version:

impair is a React framework bringing several programming concepts together in order to provide a foundation for a layered, scalable, performant and enterprise level react application.

22 lines (21 loc) 796 B
import { Dispose } from '../types'; /** * This decorator is used to mark a method as an init method. * Init methods are called after the instance is created and all the decorators are processed * Takes an optional cleanup function as a parameter. * The cleanup function will be called when the instance is disposed by the disposal of the parent dependency container. *```ts * \@onInit *public init(cleanup: Cleanup) { * const abortController = new AbortController() * cleanup(() => { * abortController.abort() * }) * * const response = await loadData(this.state.id, abortController.signal); * // do something *} *``` */ export declare function onInit(target: any, propertyKey: string): void; export declare function initOnInit(instance: any, disposers: Dispose[]): void;