Skip to content

Commit b259073

Browse files
committed
docs: make sample work with aot
1 parent 96ce7b2 commit b259073

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,30 @@ It provides `RecaptchaService`.
6464
2. `RecaptchaRender.Onload` renders the first element with `g-recaptcha` class.
6565
3. `your_sitekey` renders isolated invisible reCAPTCHA that can be used from `RecaptchaService`. V3 best practice.
6666

67-
`onload`: specifies function name on the window object.
67+
`onload`: specifies a function name on the window object. Defaults to `RecaptchaOnloadEventName = 'recaptchaloaded'`
6868

69-
`onloadFunc`: specifies function that is executed after reCAPTCHA loads.
69+
`onloadFunc`: specifies a function that is executed after reCAPTCHA loads.
7070

7171
`recaptchaUrl`: script's url. Defaults to `RecaptchaGoogleUrl = 'https://www.google.com/recaptcha/api.js'`
7272

7373
```ts
74+
export async function onLoad(recaptcha: Recaptcha) {
75+
// Sitekey Execution
76+
const result = await recaptcha.execute('your_sitekey', { action: 'background' })
77+
console.log(result)
78+
}
79+
80+
@NgModule({
81+
imports: [
82+
// ...
7483
RecaptchaLoaderModule.withParameters({
7584
language: 'en',
7685
render: 'your_sitekey',
77-
onloadFunc: async aptcha: Recaptcha) => {
78-
// Sitekey Execution
79-
const result = await recaptcha.execute('your_sitekey', { action: 'background' })
80-
},
81-
}),
86+
onloadFunc: onLoad
87+
}), // loads script and allows to use `RecaptchaService`
88+
// ...
89+
],
90+
})
8291
```
8392

8493
### RecaptchaService

0 commit comments

Comments
 (0)