|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
521 bytes
|
| Line | |
|---|
| 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 | */
|
|---|
| 15 | declare function once<F extends (...args: any[]) => any>(func: F): F;
|
|---|
| 16 |
|
|---|
| 17 | export { once };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.