Detect headset (dis)connection.
npm install nativescript-headset-detection[![Build Status][build-status]][build-url]
[![NPM version][npm-image]][npm-url]
[![Twitter Follow][twitter-image]][twitter-url]
[build-status]:https://travis-ci.org/EddyVerbruggen/nativescript-headset-detection.svg?branch=master
[build-url]:https://travis-ci.org/EddyVerbruggen/nativescript-headset-detection
[npm-image]:http://img.shields.io/npm/v/nativescript-headset-detection.svg
[npm-url]:https://npmjs.org/package/nativescript-headset-detection
[twitter-image]:https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social&label=Follow%20me
[twitter-url]:https://twitter.com/eddyverbruggen
``bash`
tns plugin add nativescript-headset-detection
#### JavaScript
`js
var headsetDetection = require("nativescript-headset-detection");
headsetDetection.isConnected()
.then(function (connected) { console.log("Connected? " + connected); })
.catch(function (err) { console.log("Error: " + err)});
`
#### TypeScript
`typescript
import * as headsetDetection from 'nativescript-headset-detection';
headsetDetection.isConnected()
.then(connected => console.log(Connected? ${connected}))Error: ${err}
.catch(err => console.log());`
#### JavaScript
``js
var headsetDetection = require("nativescript-headset-detection");
headsetDetection.onConnectionStateChanged(function (connected) {
console.log("Connection changed to: " + connected);
});
`
#### TypeScript
`typescript
import * as headsetDetection from 'nativescript-headset-detection';
headsetDetection.onConnectionStateChanged(connected => console.log(Connection changed to: ${connected}));``