KR.onTransactionCreated()
Description
KR.onTransactionCreated() intercepts all newly created transactions, whether they are accepted or rejected. KR.onTransactionCreated() accepts either a callback or a promise as a parameter.
The callback receives an object with 2 parameters:
- KR: Reference to the library
- event: Object that contains the newly created transaction.
You can stop the execution string by returning false at the end of processing:
Return value | Behavior |
---|---|
false | execution is interrupted. Error handling or redirection does not take place. |
true | The execution continues normally when the callback is executed. |
For information, there are 2 callbacks that allow to intercept a newly created transaction:
- KR.onSubmit() : when an accepted transaction is created.
- KR.onError() : When a rejected transaction is created.