-
Notifications
You must be signed in to change notification settings - Fork 6
/
examples.js
27 lines (27 loc) · 1.39 KB
/
examples.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function iProovEvent(event) {
switch(event.type) {
case 'aborted':
case 'failed':
document.querySelector('.iproov-failed span').innerText = event.detail.reason;
console.info('iProov ' + event.type + ' - ' + event.detail.feedback);
break;
case 'error':
document.querySelector('.iproov-error span').innerText = event.detail.reason;
document.querySelector('.iproov-error code').innerText = event.detail.feedback;
console.warn('iProov ' + event.type + ' - ' + event.detail.reason);
break;
case 'unsupported':
document.querySelector('.iproov-unsupported span').innerText = event.detail.reason;
document.querySelector('.iproov-unsupported code').innerText = event.detail.feedback;
console.warn('iProov ' + event.type + ' - ' + event.detail.reason);
break;
case 'progress':
document.querySelector('.iproov-progress progress').value = event.detail.progress;
document.querySelector('.iproov-progress .spinner span').innerText = event.detail.progress + '%';
document.querySelector('.iproov-progress .status').innerText = event.detail.message;
console.info(event.detail.message + ' (' + event.detail.progress + '%)');
break;
default:
console.log('iProov ' + event.type);
}
}