added _.delay definition

This commit is contained in:
Brian Zengel
2013-10-18 23:41:36 -04:00
parent 827460a00b
commit 017af6e7dd
2 changed files with 15 additions and 20 deletions
+2
View File
@@ -466,6 +466,8 @@ source.addEventListener('message', <Function>_.debounce(function() {}, 250, {
result = <number>_.defer(function() { console.log('deferred'); });
var log = _.bind(console.log, console);
result = <number>_.delay(log, 1000, 'logged later');
////////////////////////////////////////////////////////////////////////////////////////
//WHAT'S LEFT
+13 -20
View File
@@ -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,