Only set PZ2 callback for operations that we actually use. We
determine this by checking whether relevant events have been
subscribed to. (Actually, due to the way event queueing is
implemented, we also get a positive for events that have been
published, even if not subscribed to. But (A) that's going to be very
rare, and (B) even if were to happen, it would fail safe by setting up
unneeded callbacks rather than failing to set up needed ones.)
};
params.oninit = onInit;
};
params.oninit = onInit;
- 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;
+ log("setting bytarget callback");
+ }
+ if (m_queues.stat) {
+ params.onstat = onStat;
+ log("setting stat callback");
+ }
+ if (m_queues.termlists) {
+ log("setting term callback");
+ params.onterm = (config.facets.length ? onTerm : undefined);
+ }
+ if (m_queues.records) {
+ log("setting show callback");
+ params.onshow = onShow;
+ }
+ if (m_queues.record) {
+ log("setting record callback");
+ params.onrecord = onRecord;
+ }
m_paz = new pz2(params);
log("ccreated main pz2 object");
m_paz = new pz2(params);
log("ccreated main pz2 object");