MCPcopy Create free account
hub / github.com/sql-js/sql.js / selectStream

Function selectStream

documentation/javascript/application.js:235–260  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

233 var nodeStack = [];
234
235 function selectStream() {
236 if (stream1.length && stream2.length) {
237 if (stream1[0].offset != stream2[0].offset)
238 return (stream1[0].offset < stream2[0].offset) ? stream1 : stream2;
239 else {
240 /*
241 To avoid starting the stream just before it should stop the order is
242 ensured that stream1 always starts first and closes last:
243
244 if (event1 == 'start' && event2 == 'start')
245 return stream1;
246 if (event1 == 'start' && event2 == 'stop')
247 return stream2;
248 if (event1 == 'stop' && event2 == 'start')
249 return stream1;
250 if (event1 == 'stop' && event2 == 'stop')
251 return stream2;
252
253 ... which is collapsed to:
254 */
255 return stream2[0].event == 'start' ? stream1 : stream2;
256 }
257 } else {
258 return stream1.length ? stream1 : stream2;
259 }
260 }
261
262 function open(node) {
263 var result = '<' + node.nodeName.toLowerCase();

Callers 1

mergeStreamsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…