inital upload
This commit is contained in:
29
node_modules/eventsource-parser/dist/stream.js
generated
vendored
Normal file
29
node_modules/eventsource-parser/dist/stream.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import { createParser } from "./index.js";
|
||||
import { ParseError } from "./index.js";
|
||||
class EventSourceParserStream extends TransformStream {
|
||||
constructor({ onError, onRetry, onComment } = {}) {
|
||||
let parser;
|
||||
super({
|
||||
start(controller) {
|
||||
parser = createParser({
|
||||
onEvent: (event) => {
|
||||
controller.enqueue(event);
|
||||
},
|
||||
onError(error) {
|
||||
onError === "terminate" ? controller.error(error) : typeof onError == "function" && onError(error);
|
||||
},
|
||||
onRetry,
|
||||
onComment
|
||||
});
|
||||
},
|
||||
transform(chunk) {
|
||||
parser.feed(chunk);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
export {
|
||||
EventSourceParserStream,
|
||||
ParseError
|
||||
};
|
||||
//# sourceMappingURL=stream.js.map
|
||||
Reference in New Issue
Block a user