friendly-captcha-sdk > WidgetHandle
WidgetHandle class
This provides an API stub that provides the end-user JS API for a widget.
This class is only instantiated by the SDK - do not create a handle yourself.
Signature:
export declare class WidgetHandle
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(opts) | Constructs a new instance of the WidgetHandle class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
id | readonly | string | A random ID that uniquely identifies this widget in this session. |
isDestroyed | boolean | When this is true the widget has been destroyed and can no longer be used. | |
sitekey? | readonly | string | (Optional) The sitekey for this widget. It can not be changed after creation of the widget. |
startMode | StartMode |
Methods
Method | Modifiers | Description |
---|---|---|
addEventListener(type, listener, options) | Shorthand for this.getElement().addEventListener (that is strictly typed in Typescript) | |
destroy() | Destroy the widget. This removes the | |
getElement() | The HTML element that contains the widget. | |
getResponse() | The current response of the widget. This is the value that should be sent to the server and is embedded in HTML forms. | |
getState() | The current state of the widget. | |
removeEventListener(type, listener, options) | Shorthand for this.getElement().removeEventListener (that is strictly typed in Typescript) | |
reset(opts) | Reset the widget, removing any progress. Optional argument: an object with the name of the trigger that caused the reset. You would usually keep this empty. This is the | |
start() | Start the challenge. TODO: check what the current state is, in some states this probably shouldn't do anything. |