07.03.2023, 11:52
(07.03.2023, 11:40)admin Wrote: Same as for grp.listen. First argument is the group address, second argument is the callback function.
I´ve done that but it doesn´t work
callback function is " actualizarEstados(i,j) " and addreses are in the array "DirEstadosReales[i][j]"
Code:
// Detect adresses linked to widget button and create arrays
$(".screen_widget").on("click", function(e) {
removelistenerfn("0/2/1")
ObjEscucha = $(this).data("object");
for (var i = 0; i < DirOriginales.length; i++) {
//REMOVE LISTENERS
for (var j = 0; j < DirEstadosReales[i].length; j++) {
//console.log(DirEstadosReales[i][j])
removelistenerfn(DirEstadosReales[i][j],actualizarEstados(i,j))
}
if (ObjEscucha == DirOriginales[i]){
DirWrSustituidas = DirWrNuevas[i]
//I NEED TO REMOVE THIS LISTENER WHEN I OPEN AGAIN THE WIDGET
for (var j = 0; j < DirEstadosReales[i].length; j++) {
grp.listen(DirEstadosReales[i][j], actualizarEstados(i,j));
}
}
}
});