Listen to Widget events
The attachEventListener method is an optional method for attaching callback functions to specific Widget events.
1
instantor.attachEventListener(eventName, callbackFunction(payload))
Copied!
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
Description
load
{
status: true
}
Triggered when the Widget has loaded.
The payload contains status true if loading was successful.
processEnd
{
"process-finished"
}
Triggered when the process has ended, i.e. the user completed the last login step.
The payload contains a representation of the result:
"process-finished"
"invalid-login"
"process-error"
chooseBank
{
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).
error
{
message: "error message"
}
Triggered when an error occurs.
The payload contains a description of the error.
displayChange
{
display:
"bankLogin"
}
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)

Example

An example of how to use attachEventListener
1
const instantor = new Instantor('produktKey.example')
2
3
instantor.attachEventListener('chooseBank', function(payload) {
4
console.log("The user selected this bank: " + payload.bankAbbreviation);
5
})
6
7
instantor.load('#instantor_div');
Copied!
Last modified 1yr ago
Copy link
Contents
Example