1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var defer = require("lodash/defer");
|
4 | var factory_1 = require("./factory");
|
5 | var applicators_1 = require("./applicators");
|
6 | /**
|
7 | * Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to func when it's invoked.
|
8 | *
|
9 | * @param {...*} [args] Additional arguments to invoke the function with
|
10 | * @example
|
11 | *
|
12 | * class MyClass {
|
13 | * value = 100;
|
14 | *
|
15 | * @Defer()
|
16 | * add(a) {
|
17 | * this.value += a;
|
18 | * }
|
19 | * }
|
20 | *
|
21 | * const myClass = new MyClass();
|
22 | *
|
23 | * myClass.add(10);
|
24 | *
|
25 | * myClass.value; // => 100;
|
26 | *
|
27 | * setTimeout(() => {
|
28 | * myClass.value; // => 110;
|
29 | * }, 0);
|
30 | */
|
31 | exports.Defer = factory_1.DecoratorFactory.createDecorator(new factory_1.DecoratorConfig(defer, new applicators_1.InvokeApplicator(), { setter: true, optionalParams: true }));
|
32 | exports.defer = exports.Defer;
|
33 | exports.default = exports.Defer;
|
34 | //# sourceMappingURL=defer.js.map |
\ | No newline at end of file |