Events & Listeners
Registering Event Listeners
You can register as many event listeners as you'd like. To do so, ToughClicks provides a simple function in which you provide the type of event and the callback function.
TC.on("tc-accepeted", myAcceptedHandler)
Event Specifications
ToughClicks will fire two different events that we recommend you listen to:
tc-valid
- this event fires when the validation state of ToughClicks changes. It includes a boolean inevent.detail.isValid
that is true when the checkboxes are checked and we have a valid user identifier. Once this event fires, it is safe to callTC.accept()
.tc-accepted
- this event fires after all the Documents have been fully executed and immutable records have been stored in our Acceptance database. Once this event fires, it is safe to allow the Signer to proceed.tc-internal-error
- this event fires when the library experiences an internal error. For more information, please see Error Handling
Example:
function myValidHandler (e) {
if (e.detail.isValid) {
document.getElementById("btn-submit").disabled = false;
} else {
document.getElementById("btn-submit").disabled = true;
}
});
function myAcceptedHandler (e) {
console.log("tc-accepted", e.detail);
if (e.detail.allAccepted) {
alert("agreements executed");
}
});
TC.on("tc-valid", myValidHandler);
TC.on("tc-accepeted", myAcceptedHandler)
Updated 8 months ago