Skip to main content
Version: v2

@friendlycaptcha/sdk > FriendlyCaptchaSDK

FriendlyCaptchaSDK class

Main entry point for V2 of the Friendly Captcha SDK. This class keeps track of widgets and allows you to create widgets programmatically.

Generally there should only be one instance of this SDK in your website.

Signature:

export declare class FriendlyCaptchaSDK 

Constructors

ConstructorModifiersDescription
(constructor)(opts)Constructs a new instance of the FriendlyCaptchaSDK class

Properties

PropertyModifiersTypeDescription
attachedPromise<WidgetHandle[]>A promise that resolves to all the widgets that are currently attached.

Methods

MethodModifiersDescription
attach(elements)

Attaches a widget to given element or elements if they are not attached to yet.

You can pass one or more HTML elements to attach to, or undefined. If undefined is passed, the HTML page is scanned for unattached widget elements (= elements with the frc-captcha class).

Returns handles to the newly-attached elements.

clear()Completely remove all widgets and background agents related to the SDK on this page.
createWidget(opts)Creates a Friendly Captcha widget with given options under given HTML element.
getAllWidgets()Returns all current widgets known about (in an unspecified order).
getWidgetById(id)Retrieves a widget by its widget ID.