MCPcopy Create free account
hub / github.com/Yaffle/EventSource / readNextChunk

Function readNextChunk

tests/eventsource.js:543–556  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

541 // see https://github.com/promises-aplus/promises-spec/issues/179
542 return new Promise(function (resolve, reject) {
543 var readNextChunk = function () {
544 reader.read().then(function (result) {
545 if (result.done) {
546 //Note: bytes in textDecoder are ignored
547 resolve(undefined);
548 } else {
549 var chunk = textDecoder.decode(result.value, {stream: true});
550 onProgressCallback(chunk);
551 readNextChunk();
552 }
553 })["catch"](function (error) {
554 reject(error);
555 });
556 };
557 readNextChunk();
558 });
559 })["catch"](function (error) {

Callers 1

eventsource.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected