ditr-components
v1.0.4
Published
just for testing only
Downloads
2
Readme
Install via NPM
On the command line, navigate to the root directory of your project:
cd /path/to/project
Run the following command:
npm init
Answer the questions in the command line questionnaire.
Install ditr-components
:
npm i ditr-components
For example:
- index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Ditr Component</title>
<style>
.mainLayout {
max-width: max-content;
margin: auto;
}
.showComponent {
width: 500px;
height: 700px;
}
</style>
<script src="./node_modules/ditr-components/ditr-liveness.bundle.js"></script>
</head>
<body class="mainLayout">
<div class="showComponent">
<h2>Ditr Component</h2>
<ditr-liveness></ditr-liveness>
</div>
<script src="./index.js"></script>
</body>
</html>
- index.js
const ditrLiveness = document.getElementsByTagName("ditr-liveness")[0];
function ditrListener(result) {
if (result.detail.action === "START_PROCESS") {
console.log(JSON.stringify(result.detail));
}
if (result.detail.action === "FINISH_PROCESS") {
if (result.detail.result.status === "true") {
console.log(JSON.stringify(result.detail));
} else {
console.log(JSON.stringify(result.detail));
}
}
}
ditrLiveness.addEventListener("ditr-liveness", ditrListener);