Compatibility with extensions

This commit is contained in:
Cohee
2024-04-02 20:25:37 +03:00
parent 534612db87
commit f13e718dc7
3 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import { eventSource, event_types } from '../script.js';
import { power_user } from './power-user.js';
import { delay } from './utils.js';
@ -257,6 +258,7 @@ export class SmoothEventSourceStream extends EventSourceStream {
hasFocus && await delay(getDelay(lastStr));
controller.enqueue(new MessageEvent(event.type, { data: JSON.stringify(parsed.data) }));
lastStr = parsed.chunk;
hasFocus && await eventSource.emit(event_types.SMOOTH_STREAM_TOKEN_RECEIVED, parsed.chunk);
}
} catch {
controller.enqueue(event);