I'm using strophe.js for a pub/sub model that I want to implement in my aura component.However when the callback is triggered and I want to fire the component it gives an error setParams null. Since callback function only takes a single parameter I've moved all my code to controller so I have a cmp reference.
controller.js
handleLogin: function(cmp, event, helper) {
connection.addHandler((function(msg){
var x2js = new X2JS();
try {
var text = msg['firstElementChild']['firstElementChild']['textContent'];
var obj = x2js.xml_str2json(text);
console.log("On Message : ", obj);
// here if I call $A.getCallback without window.setTimeout the function doesn't trigger.
window.setTimeout(
$A.getCallback(function() {
cmp.getEvent('renderPanel').setParams({
type : 'c:callInitiatedPanel',
attributes : {
'state' : 'Incoming',
'recordName' : 'hammad',
'phone' : 'phone',
'title' : 'title',
'account' : 'account',
'recordId' : 'rid',
'presence' : 'presence'
}
}).fire()
}), 1000);
} catch(e) {
console.log("Error: ", e)
}
return true;
}), null, 'message', null, null, null);
}