1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var once = require("lodash/once");
|
4 | var factory_1 = require("./factory");
|
5 | var applicators_1 = require("./applicators");
|
6 | /**
|
7 | * Creates a function that is restricted to invoking func once. Repeat calls to the function return the value of the first invocation.
|
8 | * This is shared across all instances of the class.
|
9 | * @example
|
10 | * const value = 0;
|
11 | *
|
12 | * class MyClass {
|
13 | * @Once()
|
14 | * fn(): number {
|
15 | * return ++value;
|
16 | * }
|
17 | * }
|
18 | *
|
19 | * const myClass = new MyClass();
|
20 | * const myClass2 = new MyClass();
|
21 | *
|
22 | * myClass.fn(); //=> 1
|
23 | * myClass2.fn(); //=> 1
|
24 | */
|
25 | exports.OnceAll = factory_1.DecoratorFactory.createDecorator(new factory_1.DecoratorConfig(once, new applicators_1.PreValueApplicator(), { setter: true, optionalParams: true }));
|
26 | exports.onceAll = exports.OnceAll;
|
27 | exports.default = exports.OnceAll;
|
28 | //# sourceMappingURL=onceAll.js.map |
\ | No newline at end of file |