Chaining

As of version 3.0, GraphJS supports the Javascript Promise API.

This allows you to use promise.then(), promise.catch(), and promise.finally() methods as follows;

  GraphJS.login(username, password, (res) => { } )
    .then( (res) => doSomething(res) )
    .catch( (err) => failGracefully(err) );

where doSomething is a method that processes the succesful result of the login call.

and failGracefully is a method that processes the failed login call.