@@ -28,7 +28,8 @@ export function create_components(): {
28
28
targets : Writable < TargetMap > ;
29
29
update_value : ( updates : UpdateTransaction [ ] ) => void ;
30
30
get_data : ( id : number ) => any | Promise < any > ;
31
- close_stream : ( id : number ) => void ;
31
+ modify_stream : ( id : number , state : "open" | "waiting" | "closed" ) => void ;
32
+ get_stream_state : ( id : number ) => "open" | "waiting" | "closed" | "not_set" ;
32
33
set_time_limit : ( id : number , time_limit : number | undefined ) => void ;
33
34
loading_status : ReturnType < typeof create_loading_status_store > ;
34
35
scheduled_updates : Writable < boolean > ;
@@ -347,13 +348,25 @@ export function create_components(): {
347
348
return comp . props . value ;
348
349
}
349
350
350
- function close_stream ( id : number ) : void {
351
+ function modify_stream (
352
+ id : number ,
353
+ state : "open" | "closed" | "waiting"
354
+ ) : void {
351
355
const comp = _component_map . get ( id ) ;
352
- if ( comp && comp . instance . close_stream ) {
353
- comp . instance . close_stream ( ) ;
356
+ if ( comp && comp . instance . modify_stream_state ) {
357
+ comp . instance . modify_stream_state ( state ) ;
354
358
}
355
359
}
356
360
361
+ function get_stream_state (
362
+ id : number
363
+ ) : "open" | "closed" | "waiting" | "not_set" {
364
+ const comp = _component_map . get ( id ) ;
365
+ if ( comp && comp . instance . get_stream_state )
366
+ return comp . instance . get_stream_state ( ) ;
367
+ return "not_set" ;
368
+ }
369
+
357
370
function set_time_limit ( id : number , time_limit : number | undefined ) : void {
358
371
const comp = _component_map . get ( id ) ;
359
372
if ( comp && comp . instance . set_time_limit ) {
@@ -366,7 +379,8 @@ export function create_components(): {
366
379
targets : target_map ,
367
380
update_value,
368
381
get_data,
369
- close_stream,
382
+ modify_stream,
383
+ get_stream_state,
370
384
set_time_limit,
371
385
loading_status,
372
386
scheduled_updates : update_scheduled_store ,
0 commit comments