lodash: changed _.once() method

This commit is contained in:
Ilya Mochalov
2015-08-07 23:37:12 +05:00
parent a95ee80de0
commit f4efff6f49
2 changed files with 17 additions and 9 deletions
+4 -3
View File
@@ -958,9 +958,10 @@ result = <TestNegateResult>_.negate<TestNegatePredicate, TestNegateResult>(testN
result = <TestNegateResult>_(testNegatePredicate).negate().value();
result = <TestNegateResult>_(testNegatePredicate).negate<TestNegateResult>().value();
var initialize = _.once(function () { });
initialize();
initialize();
// _.once
result = <() => void>_.once<() => void>(function () {});
result = <() => void>(_(function () {}).once().value());
var returnedOnce = _.throttle(function (a: any) { return a * 5; }, 5);
returnedOnce(4);
+13 -6
View File
@@ -5616,15 +5616,22 @@ declare module _ {
//_.once
interface LoDashStatic {
/**
* Creates a function that is restricted to execute func once. Repeat calls to the function
* will return the value of the first call. The func is executed with the this binding of the
* created function.
* @param func Function to only execute once.
* @return The new restricted function.
**/
* Creates a function that is restricted to invoking func once. Repeat calls to the function return the value
* of the first call. The func is invoked with the this binding and arguments of the created function.
* @param func The function to restrict.
* @return Returns the new restricted function.
*/
once<T extends Function>(func: T): T;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.once
*/
once(): LoDashObjectWrapper<T>;
}
//_.partial
interface LoDashStatic {
/**