Skip to content

Commit

Permalink
Minor readme changes
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Mar 27, 2013
1 parent 6ecbeb3 commit 7817b86
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ console.log(result) // setTimeout - just like normal

## Process

- Ambi accepts the arguments `(method, args...)`, `method` is the function to execute, and `args...` is the arguments to send to the method, the last argument is expected to be the completion callback
- The completion callback is optional, but if defined, is to have the signature of `(err, results...)`
- Ambi accepts the arguments `(method, args...)`
- `method` is the function to execute
- `args...` is the arguments to send to the method
- the last argument is expected to be the completion callback
- the completion callback is optional, but if defined, is expected to have the signature of `(err, results...)`
- If the method has the same amount of arguments as those ambi received, then we assume it is an asynchronous method and let it handle calling of the completion callback itself
- If the method does not have the same amount of arguments as those ambi received, then we assume it is a synchronous method and we'll call the completion callback ourselves
- If the synchronous method throws an error or returns an error, we will try to call the completion callback with a single `err` argument
- If the synchronous method executes without error, we will try to call the completion callback with a `err` argument equal to null, and a `result` argument equal to the returned result of the synchronous method
- If the synchronous method throws an error or returns an error, we'll try to call the completion callback with a single `err` argument
- If the synchronous method executes without error, we'll try to call the completion callback with a `err` argument equal to null, and a `result` argument equal to the returned result of the synchronous method
- Ambi can also introspect a different method than the one it fires, by passing `[methodToFire, methodToIntrospect]` as the `method` argument


Expand Down

0 comments on commit 7817b86

Please sign in to comment.