Listen to Widget events
The attachEventListener method is an optional method for attaching callback functions to specific Widget events.
instantor.attachEventListener(eventName, callbackFunction(payload))
This method attaches an event listener with a specified callback function to the specified event, eventName. When triggered, the callback function is called with an event payload.
Event Name
Payload Example
status: true
Triggered when the Widget has loaded.
The payload contains status true if loading was successful.
Triggered when the process has ended, i.e. the user completed the last login step.
The payload contains a representation of the result:
bankAbbreviation: "se-swedbank",
bankID: "uuid",
sessionID: "uuid"
Triggered when the user selects a bank.
The payload contains a representation of the bank and session data:
bankAbbreviation (bank abbreviation)
bankID (unique bank ID)
sessionID (unique session ID).
message: "error message"
Triggered when an error occurs.
The payload contains a description of the error.
Triggered when the Widget changes content.
The payload contains a representation of what is displayed:
"bankLogin" (the Widget renders a bank login form)
"bankChooser" (the Widget renders the bank chooser)


An example of how to use attachEventListener
const instantor = new Instantor('produktKey.example')
instantor.attachEventListener('chooseBank', function(payload) {
console.log("The user selected this bank: " + payload.bankAbbreviation);
Copy link