Skip to content

Commit

Permalink
feature: expose click event
Browse files Browse the repository at this point in the history
  • Loading branch information
martinerko committed Feb 17, 2022
1 parent 7a6fed1 commit c28aac9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/StripeBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,14 @@ export class StripeBase extends ReadOnlyPropertiesMixin(LitNotify(LitElement)) {
}

/**
* Adds `ready`, `focus`, and `blur` listeners to the Stripe Element
* Adds `ready`, `focus`, `blur` and `click` listeners to the Stripe Element
*/
private initElementListeners(): void {
if (!this.element) return;
this.element.addEventListener('ready', this.onReady);
this.element.addEventListener('focus', this.onFocus);
this.element.addEventListener('blur', this.onBlur);
this.element.addEventListener('click', this.onClick);
}

/**
Expand Down Expand Up @@ -528,6 +529,14 @@ export class StripeBase extends ReadOnlyPropertiesMixin(LitNotify(LitElement)) {
this.fire('stripe-ready', event);
}

/**
* @param {StripeClickEvent} event
* @private
*/
@bound private async onClick(event: {preventDefault: () => void}): Promise<void> {
this.fire('click', event);
}

/**
* POSTs the payment info represenation to the endpoint at `/action`
*/
Expand Down

0 comments on commit c28aac9

Please sign in to comment.