Events
A system based on CustomEvent API is available. You can use those methods, available in paygreenjs
:
Name | Type | Description |
---|---|---|
attachEventListener | func | Subscribe to an event and attach a callback |
detachEventListener | func | Detach your callback from an event |
Events | EventsType | Constant giving all events available |
You can check the events here
The events returned are of type CustomEvent. If it's provided, you can check the attribut detail giving more informations (like detailled errors, tokens...)
Here it is an example:
paygreenjs.attachEventListener(paygreenjs.Events.TOKEN_READY, (event) => {
console.log('TOKEN_READY', event.detail);
});
OnChange
Paygreenjs is providing some onChange events, giving you the possibility to get some data when an input change. Please refer to the Events
constant to check all available onChange events.
Here it is an example:
paygreenjs.attachEventListener(paygreenjs.Events.TOKEN_READY, (event) => {
console.log('PAN_FIELD_ONCHANGE', event.detail);
});
Updated 11 months ago