1. Home
  2. Docs
  3. Lemin Developers Guide
  4. Javascript API

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()
FunctionDescriptionParameterReturn Type
getCaptchaValueReturns the captcha value on the page for needed validation() => {
“answer”: “answer”,
“challenge_id”: “challenge_id”
}
isReadyReturns the state of the captcha() => boolean
reloadPuzzleReloads puzzle, you may use it in failure scenarios.() =>void
onLoadCalls the function when the captcha loaded.(callbackFunction = function(){}) =>void
onVerifyCalls the function on pre-verification(callbackFunction = function(is_verified: boolean){}) =>boolean
loadPuzzleErrorCalls the function when the captcha loaded.(callbackFunction = function(){}) =>void
destroyCaptchaDestroys the captcha on the page() =>void
resetCaptchaResets 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') 
FunctionDescriptionParameterReturn Type
getInstancesReturns all the instances of captchas(CAPTCHA_KEY: Optional | String) =>CaptchaInstance{}
getCaptchaReturns 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).getCaptchaValueReturns the captcha value on the page for needed validation() =>{
“answer”: “answer”,
“challenge_id”: “challenge_id”
}
getCaptcha(CAPTCHA_KEY: Optional | String).isReadyReturns the state of the captcha() =>boolean
getCaptcha(CAPTCHA_KEY: Optional | String).reloadPuzzleReloads puzzle, you may use it in failure scenarios.() =>void
getCaptcha(CAPTCHA_KEY: Optional | String).onLoadCalls the function when the captcha loaded.(callbackFunction = function(){}) =>void
getCaptcha(CAPTCHA_KEY: Optional | String).loadPuzzleErrorCalls the function when the captcha loaded.(callbackFunction = function(){}) =>void
getCaptcha(CAPTCHA_KEY: Optional | String).destroyCaptchaDestroys the captcha on the page() =>void
destroyAllDestroys all captchas on the page.() =>void
resetAllResets all captchas on the page (only for the boxed type).() =>void