Skip to main content

The following sample lists Jabra devices (more specifically, their names) whenever they are connected.

  1. Make sure you've installed the Chrome Extension and the Chrome Host (see Getting Started in the Browser).

  2. Create an empty package.json and install jabra-js:

npm init -y
npm i @gnaudio/jabra-js --save
  1. Create an empty index.js file and initialize the library by using the following code snippet:

Please see our guide on Modules Import Strategies to learn more about different import formats.

// Import Jabra library
import { init } from './node_modules/@gnaudio/jabra-js/browser-esm/index.js';
async function app() {
// Initialize Jabra library
const api = await init();
// Subscribe to notifications about Jabra devices
api.deviceList.subscribe((devices) => {
// Iterate through the devices
devices.forEach((device) => {
// Log the name of the device
console.log(device.name);
});
});
}
app();
  1. Create an index.html and add the following markup:
<html>
<head>
<script src="index.js" type="module"></script>
</head>
</html>

Note the type="module" attribute on the script tag.

  1. Start your app by opening the index.html via http-server in a Chrome browser.
npx http-server index.html
  1. Attach a Jabra device (no problem if you already did this) and check the JavaScript console to see the device name.

Next steps#

Follow the Call Control tutorial to learn how to control a Jabra headset in regards to a call (e.g. ringing, accepting the call, muting, holding).