Skip to content

Commit

Permalink
make sure callback works.
Browse files Browse the repository at this point in the history
  • Loading branch information
siong1987 committed Sep 10, 2011
1 parent aded835 commit 01e540c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -25,7 +25,7 @@ Returns a Connection instance.

There are two main command that you can use `add_term` and `search_term`:

`add_term`:
`add_term(type, id, term, score, data, callback)`:

Public: Add a new term

Expand Down
10 changes: 9 additions & 1 deletion index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/index.coffee
Expand Up @@ -109,7 +109,13 @@ class Connection
# * `callback` - callback to be run (optional)
#
# Returns nothing.
add_term: (type, id, term, score, data, callback) ->
add_term: (type, id, term, score, args...) ->
if typeof(args[0]) != 'function'
data = args[0]
callback = args[args.length-1]
else if typeof(args[0]) == 'function'
callback = args[0]

# store the data in parallel
async.parallel([
((callb) =>
Expand Down

0 comments on commit 01e540c

Please sign in to comment.