diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 13c943c23..b10f9e84e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -466,6 +466,8 @@ source.addEventListener('message', _.debounce(function() {}, 250, { result = _.defer(function() { console.log('deferred'); }); +var log = _.bind(console.log, console); +result = _.delay(log, 1000, 'logged later'); //////////////////////////////////////////////////////////////////////////////////////// //WHAT'S LEFT diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9e4f8dd4d..8712be050 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1832,8 +1832,18 @@ declare module _ { func: Function, ...args: any[]): number; - - + /** + * Executes the func function after wait milliseconds. Additional arguments will be provided + * to func when it is invoked. + * @param func The function to delay. + * @param wait The number of milliseconds to delay execution. + * @param args Arguments to invoke the function with. + * @return The timer id. + **/ + export function delay( + func: Function, + wait: number, + ...args: any[]): number; @@ -1921,24 +1931,7 @@ declare module _ { fn: Function, hashFn?: (n: any) => string): Function; - /** - * Much like setTimeout, invokes function after wait milliseconds. If you pass the optional arguments, - * they will be forwarded on to the function when it is invoked. - * @param fn Function to delay `waitMS` amount of ms. - * @param wait The amount of milliseconds to delay `fn`. - * @arguments Additional arguments to pass to `fn`. - **/ - export function delay( - func: Function, - wait: number, - ...arguments: any[]): any; - - /** - * @see _delay - **/ - export function delay( - func: Function, - ...arguments: any[]): any; + /** * Creates and returns a new, throttled version of the passed function, that, when invoked repeatedly,