mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
lodash: changed _.once() method
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Vendored
+13
-6
@@ -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 {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user