google/google-api-nodejs-client — pull request #22 by javorszky (2013-03-25 23:48:36+00:00)
Title: Example added: how to load multiple libraries at once

# How to load the libraries?

Collect your libraries into an array of objects, like so:
```javascript
var library = [{n: 'calendar', v: 'v3'}, {n: 'oauth2', v: 'v2'}];
```

Define your callback function, that takes the collected objects as the only parameter:
```javascript
var callback = function(clients){
// do something with your clients object.
// for example, export it for the rest of the node app
console.log(clients);
exports.clients = clients;
};
```

Fire away
```javascript
batchLoad(library, callback);
```

## How do I use the new object?

Instead of the `client.newRequest('oauth2.userinfo.get')`, use the following:
`clients.oauth2.newRequest('oauth2.userinfo.get')...`.

All the libraries will be available at `clients.` (the 'n' in the library object). If for some reason loading encountered an error, they will be populated into the `clients.error` array.

That's pretty much it.