UNPKG

967 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var defer = require("lodash/defer");
4var factory_1 = require("./factory");
5var 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 */
31exports.Defer = factory_1.DecoratorFactory.createDecorator(new factory_1.DecoratorConfig(defer, new applicators_1.InvokeApplicator(), { setter: true, optionalParams: true }));
32exports.defer = exports.Defer;
33exports.default = exports.Defer;
34//# sourceMappingURL=defer.js.map
\No newline at end of file