UNPKG

591 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 * This is shared across all instances of the class.
5 * @example
6 * const value = 0;
7 *
8 * class MyClass {
9 * @Once()
10 * fn(): number {
11 * return ++value;
12 * }
13 * }
14 *
15 * const myClass = new MyClass();
16 * const myClass2 = new MyClass();
17 *
18 * myClass.fn(); //=> 1
19 * myClass2.fn(); //=> 1
20 */
21export declare const OnceAll: BiTypedDecorator;
22export { OnceAll as onceAll };
23export default OnceAll;