Events

You can add an eventlistener to the following events by using the following structure:

<script>
//where eventname is one of the events below.
document.addEventListener("eventname", function(event) {
        //the returned responsedata
        console.log(event.detail);
    }, false);
</script>

Webshoplogin uses the following events:

  1. "getAccesstokenResponse" which is used to retrieve the accesstoken. This event is used to obtain the accesstoken used to perform a login. In order to trigger this event the function webshoplogin.accesstoken() should be fired.
  2. "buttonresponse" which is fired after the customer has clicked on the loginbutton and has performed a login. The event returns an accesstoken which you can access by event.detail.accesstoken
  3. "webshoploginLoaded" which is fired when all WebshopLogin files are loaded. You should make sure your JavaScript files are loaded after this event. Otherwise you may encounter errors because certain WebshopLogin functions are not ready yet.
  4. "getUserResponse", this event is fired after getuser. The return object is a user object.