- params.onbytarget = onBytarget;
- params.onstat = onStat;
- params.onterm = (config.facets.length ? onTerm : undefined);
- params.onshow = onShow;
- params.onrecord = onRecord;
+ if (m_queues.targets) {
+ params.onbytarget = onBytarget;
+ that.info("setting bytarget callback");
+ }
+ if (m_queues.stat || m_queues.firstrecords || m_queues.complete) {
+ params.onstat = onStat;
+ that.info("setting stat callback");
+ }
+ if (m_queues.facets && config.facets.length) {
+ params.onterm = onTerm;
+ that.info("setting term callback");
+ }
+ if (m_queues.records) {
+ that.info("setting show callback");
+ params.onshow = onShow;
+ // Record callback is subscribed from records callback
+ that.info("setting record callback");
+ params.onrecord = onRecord;
+ }