<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@friendlycaptcha/sdk](./sdk.md) &gt; [WidgetHandle](./sdk.widgethandle.md)

## 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:**

```typescript
export declare class WidgetHandle 
```

## Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `WidgetHandle` class.

## Properties

<table><thead><tr><th>

Property


</th><th>

Modifiers


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[id](./sdk.widgethandle.id.md)


</td><td>

`readonly`


</td><td>

string


</td><td>

A random ID that uniquely identifies this widget in this session.


</td></tr>
<tr><td>

[isDestroyed](./sdk.widgethandle.isdestroyed.md)


</td><td>


</td><td>

boolean


</td><td>

When this is true the widget has been destroyed and can no longer be used.


</td></tr>
<tr><td>

[sitekey?](./sdk.widgethandle.sitekey.md)


</td><td>

`readonly`


</td><td>

string


</td><td>

_(Optional)_ The sitekey for this widget. It can not be changed after creation of the widget.


</td></tr>
<tr><td>

[startMode](./sdk.widgethandle.startmode.md)


</td><td>


</td><td>

[StartMode](./sdk.startmode.md)


</td><td>


</td></tr>
</tbody></table>

## Methods

<table><thead><tr><th>

Method


</th><th>

Modifiers


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[addEventListener(type, listener, options)](./sdk.widgethandle.addeventlistener.md)


</td><td>


</td><td>

Shorthand for `this.getElement().addEventListener` (that is strictly typed in Typescript)


</td></tr>
<tr><td>

[destroy()](./sdk.widgethandle.destroy.md)


</td><td>


</td><td>

Destroy the widget.

This removes the `element` that the widget was mounted to as well as the hidden `frc-captcha-response` form field.


</td></tr>
<tr><td>

[getElement()](./sdk.widgethandle.getelement.md)


</td><td>


</td><td>

The HTML element that contains the widget.


</td></tr>
<tr><td>

[getResponse()](./sdk.widgethandle.getresponse.md)


</td><td>


</td><td>

The current response of the widget. This is the value that should be sent to the server and is embedded in HTML forms.


</td></tr>
<tr><td>

[getState()](./sdk.widgethandle.getstate.md)


</td><td>


</td><td>

The current state of the widget.


</td></tr>
<tr><td>

[removeEventListener(type, listener, options)](./sdk.widgethandle.removeeventlistener.md)


</td><td>


</td><td>

Shorthand for `this.getElement().removeEventListener` (that is strictly typed in Typescript)


</td></tr>
<tr><td>

[reset(opts)](./sdk.widgethandle.reset.md)


</td><td>


</td><td>

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 `trigger` field in the `frc:widget.reset` event, which defaults to `root`<!-- -->.


</td></tr>
<tr><td>

[start()](./sdk.widgethandle.start.md)


</td><td>


</td><td>

Trigger the widget to start a challenge. The widget will start a challenge solving in the background.

\* In `interactive` mode, the user will need to click the widget to complete the process. \* In `noninteractive` mode, the widget will complete the process automatically.


</td></tr>
</tbody></table>

