mobx-bonsai
Version:
A fast lightweight alternative to MobX-State-Tree + Y.js two-way binding
12 lines (11 loc) • 421 B
TypeScript
/**
* A function for disposing resources.
*/
export type Dispose<A extends any[] = []> = (...args: A) => void;
/**
* Wraps a function to ensure it is only executed once.
*
* @param fn - The function to be executed only once.
* @returns A new function that calls the original function only the first time it is invoked.
*/
export declare function disposeOnce<A extends any[]>(fn: (...args: A) => void): Dispose<A>;