Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updating FAQ to mention this.async. Closes #122.

  • Loading branch information...
commit d4c98adbf567af31641e52ee997cc9c5ccc94c2c 1 parent 820a0fd
Ben Alman authored

Showing 1 changed file with 8 additions and 8 deletions. Show diff stats Hide diff stats

  1. 16  docs/faq.md
16  docs/faq.md
Source Rendered
@@ -27,16 +27,16 @@ Note that the `phantomjs` executable needs to be in the system `PATH` for grunt
27 27
 * [Where does $PATH get set in OS X 10.6 Snow Leopard?](http://superuser.com/questions/69130/where-does-path-get-set-in-os-x-10-6-snow-leopard)
28 28
 * [How do I change the PATH variable in Linux](https://www.google.com/search?q=How+do+I+change+the+PATH+variable+in+Linux)
29 29
 
30  
-## Why doesn't my asynchronous task work?! <a name="why-doesnt-my-asynchronous-task-work" href="#why-doesnt-my-asynchronous-task-work" title="Link to this section">⚑</a>
  30
+## Why doesn't my asynchronous task complete? <a name="why-doesnt-my-asynchronous-task-complete" href="#why-doesnt-my-asynchronous-task-complete" title="Link to this section">⚑</a>
  31
+Chances are this is happening because you have forgotten to call the [this.async](api_task.md#this-async-grunt-task-current-async) method to tell grunt that your task is asynchronous. For simplicity's sake, grunt uses a synchronous coding style, which can be switched to asynchronous by calling `this.async()` within the task body.
31 32
 
32  
-Chances are it's because you have forgotten to use the tell the current task that you are using [async](https://github.com/cowboy/grunt/blob/master/docs/api_task.md#this-async-grunt-task-current-async) behaviour.
  33
+Note that passing `false` to the `done()` function tells grunt that the task has failed.
33 34
 
34  
-For simplicity of use and a clean, readable code Grunt uses a synchronous coding style.  If you are creating a task that does integrate with an asynchronous module or you prefer to write in an asynchronous style be sure to call `this.async()` within the task body and grunt will provide you with a callback function to use, e.g.:
  35
+For example:
35 36
 
36  
-```js
37  
-grunt.registerTask('asyncme', 'Your task description goes here.', function() {
38  
-  var callback = this.async();
39  
-
40  
-  doSomethingAsync(callback);
  37
+```javascript
  38
+grunt.registerTask('asyncme', 'My asynchronous task.', function() {
  39
+  var done = this.async();
  40
+  doSomethingAsync(done);
41 41
 });
42 42
 ```

0 notes on commit d4c98ad

Please sign in to comment.
Something went wrong with that request. Please try again.