mirror of
				https://github.com/SillyTavern/SillyTavern.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	Don't delay when not in focus
This commit is contained in:
		| @@ -238,6 +238,7 @@ export class SmoothEventSourceStream extends EventSourceStream { | |||||||
|                 const event = chunk; |                 const event = chunk; | ||||||
|                 const data = event.data; |                 const data = event.data; | ||||||
|                 try { |                 try { | ||||||
|  |                     const hasFocus = document.hasFocus(); | ||||||
|                     const json = JSON.parse(data); |                     const json = JSON.parse(data); | ||||||
|  |  | ||||||
|                     if (!json) { |                     if (!json) { | ||||||
| @@ -251,7 +252,7 @@ export class SmoothEventSourceStream extends EventSourceStream { | |||||||
|                             return controller.enqueue(event); |                             return controller.enqueue(event); | ||||||
|                         } |                         } | ||||||
|  |  | ||||||
|                         await delay(getDelay(lastStr)); |                         hasFocus && await delay(getDelay(lastStr)); | ||||||
|                         controller.enqueue(new MessageEvent(event.type, { data: JSON.stringify(parsed.data) })); |                         controller.enqueue(new MessageEvent(event.type, { data: JSON.stringify(parsed.data) })); | ||||||
|                         lastStr = parsed.chunk; |                         lastStr = parsed.chunk; | ||||||
|                     } |                     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user