Global

Type Definitions

StdCallback(error, result)

  • An standard callback. It can use for both async and ansync action
  • All of callback in module must use that type as standard. It will make easy to write and handle async callback
Parameters:
Name Type Description
error object

Error occur during perform async action

result object

Result from action

Source:
Example
// this is instance of StdCallback
function queryCallback(err, items) {
  // handle error
  if (err) {
    // do some thing to handle error here

    return
  }

  // other action with items from database
  console.log(items)
}

asynQuery(queryCallback)