source: node_modules/es-toolkit/dist/function/once.d.mts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 521 bytes
RevLine 
[a762898]1/**
2 * Creates a function that is restricted to invoking func once. Repeat calls to the function return the value of the first invocation.
3 *
4 * @template F - The type of the function.
5 * @param {F} func - The function to restrict.
6 * @returns {F} Returns the new restricted function.
7 *
8 * @example
9 * const initialize = once(createApplication);
10 *
11 * initialize();
12 * initialize();
13 * // => `createApplication` is invoked once
14 */
15declare function once<F extends (...args: any[]) => any>(func: F): F;
16
17export { once };
Note: See TracBrowser for help on using the repository browser.