mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
Implement disconnect() to tidy up (remove) event listeners from the DOM when finished
This commit is contained in:
@@ -32,6 +32,11 @@ export default class extends Controller {
|
||||
this.stripeElement.addEventListener("change", this.updateErrors);
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.parentForm.removeEventListener("submit", this.stripeSubmit);
|
||||
this.stripeElement.removeEventListener("change", this.updateErrors);
|
||||
}
|
||||
|
||||
// Before the form is submitted we send the card details directly to Stripe (via StripeJS),
|
||||
// and receive a token which represents the card object, and add that token into the form.
|
||||
stripeSubmit = (event) => {
|
||||
|
||||
Reference in New Issue
Block a user