UNPKG

1.32 kBSource Map (JSON)View Raw
1{"version":3,"file":"defer.js","sourceRoot":"","sources":["src/defer.ts"],"names":[],"mappings":";;AAAA,oCAAuC;AAEvC,qCAAiF;AACjF,6CAAiD;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACU,QAAA,KAAK,GAAG,0BAAgB,CAAC,eAAe,CACnD,IAAI,yBAAe,CAAC,KAAK,EAAE,IAAI,8BAAgB,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CACtE,CAAC;AACL,gBAHL,aAAK,CAGK;AACvB,kBAAe,aAAK,CAAC","sourcesContent":["import defer = require('lodash/defer');\n\nimport { DecoratorConfig, DecoratorFactory, BiTypedDecoratorN } from './factory';\nimport { InvokeApplicator } from './applicators';\n\n/**\n * Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to func when it's invoked.\n *\n * @param {...*} [args] Additional arguments to invoke the function with\n * @example\n *\n * class MyClass {\n * value = 100;\n *\n * @Defer()\n * add(a) {\n * this.value += a;\n * }\n * }\n *\n * const myClass = new MyClass();\n *\n * myClass.add(10);\n *\n * myClass.value; // => 100;\n *\n * setTimeout(() => {\n * myClass.value; // => 110;\n * }, 0);\n */\nexport const Defer = DecoratorFactory.createDecorator(\n new DecoratorConfig(defer, new InvokeApplicator(), { setter: true, optionalParams: true })\n) as BiTypedDecoratorN;\nexport { Defer as defer };\nexport default Defer;\n"]}
\No newline at end of file