Skip to content

Commit

Permalink
better examples
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed May 30, 2016
1 parent d55f357 commit 20d1873
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ First you'll want to check whether or not the user has a configured fingerprint
You can use this to show a 'log in with your fingerprint' button next to a username/password login form.
```js
window.plugins.touchid.isAvailable(
function(msg) {alert('ok: ' + msg)}, // success handler: TouchID available
function(msg) {alert('not ok: ' + msg)} // error handler: no TouchID available
function() {alert('available!')}, // success handler: TouchID available
function(msg) {alert('not available, message: ' + msg)} // error handler: no TouchID available
);
```

Expand Down Expand Up @@ -125,19 +125,22 @@ before accepting valid fingerprints again.

```js
window.plugins.touchid.isAvailable(
function(available) {
if (available) {
// success handler; available
function() {
window.plugins.touchid.didFingerprintDatabaseChange(
function(changed) {
if (changed) {
// re-auth the user by asking for his credentials before allowing a fingerprint scan again
} else {
// call the fingerprint scanner
function(changed) {
if (changed) {
// re-auth the user by asking for his credentials before allowing a fingerprint scan again
} else {
// call the fingerprint scanner
}
}
}
);
},
// error handler; not available
function(msg) {
// use a more traditional auth mechanism
}
}
);
```

Expand Down

0 comments on commit 20d1873

Please sign in to comment.