mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
* Update `ReCaptchaV2.Parameters` to include new optional parameter `badge` * Add `ReCaptchaV2.Badge` type to hold allowed values for `ReCaptchaV2.Parameters.badge` * Update `ReCaptchaV2.Size` type to include `"invisible"` value as valid * Add `tslint.json` file to grecaptcha fixes #16245
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
const params: ReCaptchaV2.Parameters = {
|
|
sitekey: "mySuperSecretKey",
|
|
theme: "light",
|
|
type: "image",
|
|
size: "normal",
|
|
tabindex: 5,
|
|
callback: (response: string) => { },
|
|
"expired-callback": () => { },
|
|
};
|
|
|
|
const size1: ReCaptchaV2.Size = "compact";
|
|
const size2: ReCaptchaV2.Size = "invisible";
|
|
const size3: ReCaptchaV2.Size = "normal";
|
|
|
|
const badge1: ReCaptchaV2.Badge = "bottomleft";
|
|
const badge2: ReCaptchaV2.Badge = "bottomright";
|
|
const badge3: ReCaptchaV2.Badge = "inline";
|
|
|
|
const invisibleParams: ReCaptchaV2.Parameters = {
|
|
sitekey: "siteKey",
|
|
badge: badge1,
|
|
};
|
|
|
|
const id1: number = grecaptcha.render("foo");
|
|
const id2: number = grecaptcha.render("foo", params);
|
|
const id3: number = grecaptcha.render(document.getElementById("foo"));
|
|
const id4: number = grecaptcha.render(document.getElementById("foo"), params);
|
|
|
|
// response takes a number and returns a string
|
|
const response1: string = grecaptcha.getResponse(id1);
|
|
|
|
// reset takes a number
|
|
grecaptcha.reset(id1);
|
|
|
|
grecaptcha.execute();
|
|
grecaptcha.execute(id1);
|