Javascript API

Lemin comes with built-in functions to help developing processes. You may use these functions on single/multiple captchas on the page.

You can access the captcha with the code below.

window.leminCroppedCaptcha.getCaptcha()
Function Description Parameter Return Type
getCaptchaValue Returns the captcha value on the page for needed validation () => 
{
"answer": "answer",
"challenge_id": "challenge_id"
}
isReady Returns the state of the captcha () =>  boolean
reloadPuzzle Reloads puzzle, you may use it in failure scenarios. () => void
onLoad Calls the function when the captcha loaded. (callbackFunction = function(){}) => void
onVerify Calls the function on pre-verification (callbackFunction = function(is_verified: boolean){}) => boolean
loadPuzzleError Calls the function when the captcha loaded. (callbackFunction = function(){}) => void
destroyCaptcha Destroys the captcha on the page () => void
resetCaptcha Resets the captcha on the page (only for boxed type) () => void

Multiple Instances

You can access the captcha with the code below.

 window.leminCroppedCaptcha.getCaptcha('CAPTCHA_KEY') 
Function Description Parameter Return Type
getInstances Returns all the instances of captchas (CAPTCHA_KEY: Optional | String) => CaptchaInstance{}
getCaptcha Returns the given CAPTCHA_KEY's captcha instance. If CAPTCHA_KEY is empty, it will return the first captcha instance.

(CAPTCHA_KEY: Optional | String) =>

 

CaptchaInstance
getCaptcha(CAPTCHA_KEY: Optional | String).getCaptchaValue Returns the captcha value on the page for needed validation () =>
{
"answer": "answer",
"challenge_id": "challenge_id"
}
getCaptcha(CAPTCHA_KEY: Optional | String).isReady Returns the state of the captcha () => boolean
getCaptcha(CAPTCHA_KEY: Optional | String).reloadPuzzle Reloads puzzle, you may use it in failure scenarios. () => void
getCaptcha(CAPTCHA_KEY: Optional | String).onLoad Calls the function when the captcha loaded. (callbackFunction = function(){}) => void
getCaptcha(CAPTCHA_KEY: Optional | String).loadPuzzleError Calls the function when the captcha loaded. (callbackFunction = function(){}) => void
getCaptcha(CAPTCHA_KEY: Optional | String).destroyCaptcha Destroys the captcha on the page () => void
destroyAll Destroys all captchas on the page. () => void
resetAll Resets all captchas on the page (only for the boxed type). () => void