Integrations

Events

GraphJS is event-driven. You can trigger certain functions at given hooks. Each method represented under the "Functions" tab in the navigation menu comes with a "after" and "before" hook.

For example, login comes with "beforeLogin" and "afterLogin" hooks. You may use them to trigger certain functions at specific times. Presently available events are all authentication-related, and they are:

  • beforeLogin
  • afterLogin
  • beforeRegister
  • afterRegister
  • beforeLogout
  • afterLogout

Please note, while before* events do not trigger functions with any parameters, after* events do trigger with two parameters, first one being "args" which consists of an array of all arguments passed to the function that was triggered, and second one being "data" which is the successful response.data result of the function that was triggered.

Besides these authentication related functions, all show* functions also come with "before" and "after" events. To illustrate, showLogin has beforeShowLogin and afterShowLogin hooks.

You may bind a function to a hook by using GraphJS' on method. So, in order to trigger a console.log after logging in, you type in:

...

Please note, the "before" events may interrupt the progression of the call. The code block fired after the "before" event must finish with the goToNextStep(true); call. This ensures that the actual call gets executed.