Update README.

This commit is contained in:
Julien Fontanet 2015-02-23 12:25:30 +01:00
parent fd066e5eef
commit 6e42a67268

View File

@ -29,12 +29,28 @@ remote XO objects. It also automatically reconnect and retry method
calls when necessary.
```javascript
var xo = new xoLib.Xo({
url: 'https://xo.company.tld',
auth: {
// Connect to XO.
var xo = new xoLib.Xo('https://xo.company.tld');
// Must sign in before being able to call any methods (all calls will
// be buffered until signed in).
xo.signIn({
email: 'admin@admin.net',
password: 'admin',
},
}).then(function () {
console('signed as', xo.user);
});
```
The credentials can also be passed directly to the constructor:
```javascript
var xo = new xoLib.Xo({
url: 'https://xo.company.tld',
credentials: {
email: 'admin@admin.net',
password: 'admin',
}
});
```