Skip to main content

Callbacks

Address Finder also provides callbacks which let you hook into specific events.

onAddressPopulated#

onAddressPopulated

Invoked after the selected address is applied to input fields.

onAddressRetrieved#

onAddressRetrieved

Invoked when the Address Finder client has retrieved a full address from the API following a user accepting a suggestion. The first argument is an object representing the address that has been retrieved.

onAddressSelected#

onAddressSelected

Invoked immediately after the user has selected a suggestion (either by click or keypress). The first argument is an object which represents the suggestion selected.

onBlur#

onBlur

Invoked when the user unfocuses from the address input field.

onClose#

onClose

Invoked when Address Finder suggestion box is closed (i.e. hidden from user).

onFailedCheck#

onFailedCheck

Invoked function invoked if checkKey is enabled and the check fails.

onFocus#

onFocus

Invoked when user selects or focuses address input field.

onInput#

onInput

Invoked when user selects or focuses address input field.

onKeyDown#

Invoked when keypress is triggerd on input.

onLoaded#

onLoaded

Invoked when Address Finder has been successfully attached to the input element.

onMounted#

onMounted

Invoked when controller attaches to the DOM (controller.view.attach()).

onMouseDown#

Invoked when mousedown event is triggered on suggestion list

onOpen#

onOpen

Invoked when Address Finder suggestion box is opened (i.e. presented to the user).

onRemove#

onRemove

Invoked when controller detaches from the DOM (controller.view.detach()).

onSearchError#

onSearchError

Invoked when an error has occurred following an attempt to retrieve a full address. In this scenario the user will also receive a message to manually input their address.

The first argument is an error instance (i.e. inherits from Error) representing the error which has occurred.

Examples of errors includes "lookup balance exhausted" and "lookup limit reached" errors.

onSelect#

Invoked when a suggestion has been selected.

onSuggestionError#

onSuggestionError

Invoked when an error has occurred following an attempt to retrieve suggestions for a key press. In this scenario the user will also receive a message to manually input their address.

The first argument is an error instance (i.e. inherits from Error) representing the error which has occurred.

Examples of errors includes "lookup balance exhausted" and "lookup limit reached" errors.

onSuggestionsRetrieved#

onSuggestionsRetrieved

Invoked immediately after address suggestions are retrieved from the API. The first argument is an array of address suggestions.

onUnhide#

Invoked when hidden fields are unhidden (i.e. user selects an address or opts for manual input)