[web-bluetooth] How to add disconnect event handler

aircable has just created a new issue for 
https://github.com/WebBluetoothCG/web-bluetooth:

== How to add disconnect event handler ==
I would like to get a disconnect event from the gatt server.

            navigator.bluetooth.requestDevice(options)
                .then(function ( device ) {
                    console.log('Name: ' + device.name);
                    server.addEventListener( 'gattserverdisconnected',
 handleDisconnect );
                    return device.gatt.connect();
                })
                .then(function ( server ) {
                    console.log('server ' + server );
                    return server.getPrimaryService( MESH_SERVICE_UUID
 );
                })

The event listener add is accepted, but never executed. The 
BluetoothRemoteGATTServer object does not have a addEventListener 
function.
Am I doing something wrong? This is on Android Chrome 51.0.2704.81
Thanks

Please view or discuss this issue at 
https://github.com/WebBluetoothCG/web-bluetooth/issues/244 using your 
GitHub account

Received on Tuesday, 14 June 2016 18:51:52 UTC