I am new to ConverseJS Development. ConverseJS initialize()
will set DEFAULT settings just once...I want to achieve the following : Play a sound only when browser window is not in focus and a new message arrives. Is there an option where I can ADD attributes like play_sounds to true when some event is triggered like we have in jQuery as follows :
$('#datePickerId').datepicker('option', 'minDate', '3');
For now my current code is as follows :
converse.listen.on('message', function (messageXML) {
if(false === document.hasFocus()){
console.log("Window is NOT in FOCUS");
converse.initialize({
play_sounds: true
});
}
});
But this is as good as setting play_sounds for all my messages...Is there a way I can TOGGLE play sounds to ON and OFF based on Window focus...
Any help would be great. Thanks !