Instructions
U.are.U SDK - Developer Guide 34
The JavaScript API
Each method returns an ECMAScript 6 Promise object. The fulfillment handler receives the result of the method, if
any, and the rejection handler receives an instance of the standard Error object.
enumerateDevices()
The enumerateDevices() method returns the list of identifiers for all fingerprint readers connected to the computer.
TypeScript declaration
enumerateDevices(): Promise<string[]>;
Parameters - None
Returns
Returns an ES6 promise, which gets fulfilled if the list of the readers is received successfully, or rejected otherwise.
The fulfillment handler receives an array of strings, each string contains the unique identifier of each reader.
Code Snippet - The following code will print out device UIDs for all connected fingerprint readers.
var FingerprintSdkTest = (function () {
function FingerprintSdkTest() {
this.sdk = new Fingerprint.WebApi;
}
FingerprintSdkTest.prototype.getDeviceList = function () {
return this.sdk.enumerateDevices();
};
return FingerprintSdkTest;
})();
window.onload = function () {
test = new FingerprintSdkTest();
var allReaders = test.getDeviceList();
allReaders.then(function (sucessObj) {
for (i=0;i<sucessObj.length;i++){
console.log(sucessObj[i]);
}
}, function (error){
console.log(error.message);
});
}
getDeviceInfo()
The getDeviceInfo() method returns information about a connected fingerprint reader.
TypeScript declaration
getDeviceInfo(deviceUid: string): Promise<DeviceInfo>;
Parameter
Returns
Returns an ES6 promise, which gets fulfilled if the information about the reader is received successfully, or rejected
otherwise. The fulfillment handler receives an instance of the DeviceInfo object, which will be described below.
Parameter Description
deviceUid
Required. The unique identifier of the fingerprint reader.