UNPKG

523 BTypeScriptView Raw
1import { BiTypedDecorator } from './factory';
2/**
3 * Creates a function that is restricted to invoking func once. Repeat calls to the function return the value of the first invocation.
4 * @example
5 * class MyClass {
6 * value: number = 0;
7 *
8 * @Once()
9 * fn(): number {
10 * return ++this.value;
11 * }
12 * }
13 *
14 * const myClass = new MyClass();
15 *
16 * myClass.fn(); //=> 1
17 * myClass.fn(); //=> 1
18 * myClass.fn(); //=> 1
19 */
20export declare const Once: BiTypedDecorator;
21export { Once as once };
22export default Once;