File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,23 @@ export class ReactPyDjangoClient
25
25
onMessage : async ( { data } ) =>
26
26
this . handleIncoming ( JSON . parse ( data ) ) ,
27
27
...props . reconnectOptions ,
28
+ onClose : ( ) => {
29
+ // If offlineElement exists, show it and hide the mountElement/prerenderElement
30
+ if ( this . prerenderElement ) {
31
+ this . prerenderElement . hidden = true ;
32
+ }
33
+ if ( this . offlineElement ) {
34
+ this . mountElement . hidden = true ;
35
+ this . offlineElement . hidden = false ;
36
+ }
37
+ } ,
38
+ onOpen : ( ) => {
39
+ // If offlineElement exists, hide it and show the mountElement
40
+ if ( this . offlineElement ) {
41
+ this . offlineElement . hidden = true ;
42
+ this . mountElement . hidden = false ;
43
+ }
44
+ } ,
28
45
} ) ;
29
46
this . mountElement = props . mountElement ;
30
47
this . prerenderElement = props . prerenderElement ;
You can’t perform that action at this time.
0 commit comments