diff --git a/README.md b/README.md index 8067f8213..08c12c464 100644 --- a/README.md +++ b/README.md @@ -3431,7 +3431,7 @@ defer(longRunningFunction); // Browser will update the HTML then run the functio
[⬆ Back to top](#table-of-contents) -### defer +### delay Invokes the provided function after `wait` milliseconds. diff --git a/docs/index.html b/docs/index.html index a95790372..7c85f7213 100644 --- a/docs/index.html +++ b/docs/index.html @@ -762,7 +762,7 @@ console.log< document.querySelector('#someElement').innerHTML = 'Hello'; longRunningFunction(); //Browser will not update the HTML until this has finished defer(longRunningFunction); // Browser will update the HTML then run the function -

defer

Invokes the provided function after wait milliseconds.

Use setTimeout() to delay execution of fn. Use the spread (...) operator to supply the function with an arbitrary number of arguments.

const delay = (fn, wait, ...args) => setTimeout(fn, wait, ...args);
+

delay

Invokes the provided function after wait milliseconds.

Use setTimeout() to delay execution of fn. Use the spread (...) operator to supply the function with an arbitrary number of arguments.

const delay = (fn, wait, ...args) => setTimeout(fn, wait, ...args);
 
delay(
   function(text) {
     console.log(text);