MCPcopy Index your code
hub / github.com/share/sharedb / createQueryEmitter

Function createQueryEmitter

lib/backend.js:688–706  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

686 }
687
688 function createQueryEmitter() {
689 if (options.ids) {
690 var queryEmitter = new QueryEmitter(request, streams, options.ids);
691 backend.emit('timing', 'querySubscribe.reconnect', Date.now() - start, request);
692 callback(null, queryEmitter);
693 return;
694 }
695 // Issue query on db to get our initial results
696 backend._query(agent, request, function(err, snapshots, extra) {
697 if (err) {
698 destroyStreams();
699 return callback(err);
700 }
701 var ids = pluckIds(snapshots);
702 var queryEmitter = new QueryEmitter(request, streams, ids, extra);
703 backend.emit('timing', 'querySubscribe.initial', Date.now() - start, request);
704 callback(null, queryEmitter, snapshots, extra);
705 });
706 }
707
708 channels.forEach(function(channel) {
709 backend.pubsub.subscribe(channel, function(err, stream) {

Callers 1

backend.jsFile · 0.85

Calls 3

destroyStreamsFunction · 0.85
pluckIdsFunction · 0.85
callbackFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…