Skip to content

Commit c8f09f4

Browse files
committed
Add an explanation for FragmentMatcher
1 parent 6d6770d commit c8f09f4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/participant/streamParsing.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ class StreamingKMP {
7474
}
7575
}
7676

77+
// This class is essentially a state machine that processes a stream of text fragments
78+
// and emitting a callback with the content between each start and end identifier. The
79+
// two states we have are:
80+
// 1. "waiting for start identifier" - `_matchedContent === undefined`
81+
// 2. "waiting for end identifier" - `_matchedContent !== undefined`
82+
// with the state transitioning from one to the other when the corresponding identifier
83+
// is matched in the fragment stream.
7784
class FragmentMatcher {
7885
private _startMatcher: StreamingKMP;
7986
private _endMatcher: StreamingKMP;

0 commit comments

Comments
 (0)