Skip to content

Commit

Permalink
Merge pull request #312 from lyra/fix/renderElements-provisional-types
Browse files Browse the repository at this point in the history
fix(docs): example + types update
  • Loading branch information
s-yagues authored Oct 19, 2023
2 parents 16a6748 + cc9349a commit b319a9d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ const endPoint = '~~CHANGE_ME_ENDPOINT~~';
/* Load the remote library and get the KR object */
const { KR } = await KRGlue.loadLibrary(endPoint, publicKey)
/* Setting configuration */
await KR.setFormConfig({ 'kr-language': 'en-US' }))
await KR.setFormConfig({ 'kr-language': 'en-US' })
/* Attach a payment form to a given DOM selector */
const { result } = await KR.attachForm('#myPaymentForm'))
const { result } = await KR.attachForm('#myPaymentForm')
/* Show the payment form */
await KR.showForm(result.formId));
await KR.showForm(result.formId);
```
> **Note**
>
Expand Down
7 changes: 7 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ declare interface KR {
attachForm: (
formSelector: string
) => Promise<{ KR: KR; result: { formId: string } }>
/**
* Renders KR in the given selector or HTML element.
* @param $elements - Form query selector or HTML element or array of HTML elements or undefined
*/
renderElements: (
$elements: string | HTMLElement | Array<HTMLElement> | undefined
) => Promise<void>
/**
* Show form.
* @param formId - Form id
Expand Down

0 comments on commit b319a9d

Please sign in to comment.