Result
Last updated
Last updated
This component can be found under the Sybrin.Biometrics
namespace and is called ResultComponent
.
Full name: Sybrin.Biometrics.ResultComponent
.
It is a component that displays the result of a liveness detection provided by the Sybrin Biometrics JavaScript API and presents it in the form of a UI component. It's recommended that you use this component if you do not wish to create your own UI and simply want to display a result provided by a completion of the Sybrin Biometrics Web SDK liveness detection.
The liveness result may be obtained by either using an instance of the JavaScript API or by using a liveness detection component such as PassiveComponent
to run a liveness test.
With default styling, the result component appears as follows:
Upon clicking "Continue", the onContinue
event will fire.
Upon clicking "Retry", the onRetake
event will fire.
The result component can be initialized using the following code:
The Sybrin Web SDK provides the option to either pass down the ID of the element you wish to use for component initialization, or to pass the element directly.
Please note that 'result' is just an example in this context and the ID may be changed as desired as long as it matches the value passed down during component initialization in JavaScript.
During initialization, the result component allows for a number of configuration options that may be passed down using an object literal. The parameters that may be used on the object include the following:
Required:
id (string)
: ID of the element you wish to use for component initialization. Not required if element
is passed.
element (HTMLElement)
: Element you wish to use for component initialization. Not required if id
is passed.
result (Sybrin.Biometrics.PassiveLivenessResult)
: The Sybrin.Biometrics.PassiveLivenessResult
instance to construct the UI with.
Warning: Initialization will fail if the intended host element does not exist yet.
Always ensure that the initialize function is only called once the DOM is loaded.
The passive component may be removed from the UI by calling the "destroy()" function on it.
Example:
The result component offers multiple events. To hook onto an event, simply assign a function to it.
The following options are available:
onContinue()
onRetake()
This function is called when the user clicks on the continue button. To hook onto the event, you may use the following code:
No parameter is passed to this function call.
This function is called when the user clicks on the retake button. To hook onto the event, you may use the following code:
No parameter is passed to this function call.
The result component is structured a follows:
The classes and elements specified above may be used to freely style the result component as desired. To do so, simply create a stylesheet and include it in the project, then style according to the above classes and elements.
Depending on the alive state of the provided result, visibility of certain div elements alternates.
When alive
is true...
sybrin-biometrics-result-continue
is shown
sybrin-biometrics-result-retry
is hidden
When alive
is false...
sybrin-biometrics-result-continue
is hidden
sybrin-biometrics-result-retry
is shown
Styling implementation example: